mysql資料庫預設路徑修改
啟動httpd服務
<strong>mkdir -p /run/httpd</strong><strong><br></strong><strong>systemctl start httpd.service</strong>
端口port分开 配置文件分开 socket分开 日志分开 多serverid 都可以使用mysql用户 #总结,初始化多次数据库
建立目錄修改權限
<strong>mkdir /share/work/mysql mkdir /share/work/mysql/3306<br></strong><strong>chown mysql:mysql -R /share/work/mysql</strong>
cp /etc/my.cnf /share/work/mysql
[mysqld] basedir=/opt/rocks/mysql datadir=/share/work/mysql/3306/data port=3306 socket=/share/work/mysql/3306/mysql.sock log-error=/share/work/mysql/3306/data/mysql.err log-bin=/share/work/mysql/3306/data/mysql-bin server_id=7
安裝資料庫
groupadd mysql
useradd -r -g mysql mysql
--skip-grant-tables
#設定開機啟動:
初始化密碼並且授權遠端登入
/share/work/mysql/3306/mysql.sock
##6.關閉多實例
[root @db01 scripts]# mysqladmin -S /share/work/mysql/3306/mysql.sock shutdown
#7.檢查連接埠
[root@db01 scripts]# netstat -lntup|grep 330
##tcp6 0 0 :::3306 LISTEN 25550/mysqld
#8.設定多重實例密碼
[root@db01 scripts]# mysqladmin -uroot -S /share/work/ mysql/3306/mysql.sock password '3306'
#9.驗證庫連線( 查看server_id )
#[root@db01 scripts ]# mysql -uroot -p3306 -S /share/work/mysql/3306/mysql.sock -e "show variables like 'server_id';"Warning: Using a password on the command line interface can be insecure.
--------------- -------
| Variable_name | Value |
--------------- -------
| server_id | 7 |
--------------- -------
以上是rocks mysql資料庫多實例資料庫配置的範例分析的詳細內容。更多資訊請關注PHP中文網其他相關文章!