mysql預設啟動3306埠例項。現需求再啟動乙個3307埠例項。
建立3307例項資料所在目錄:
mkdir -p /data/mysqldata/mysql3307
mkdir -p /data/mysqldata/mysql3307/data
chown -r mysql:mysql /data/mysqldata/mysql3307
生成資料:
mysql_install_db --basedir=/data/mysqldata/mysql3307 --datadir=/data/mysqldata/mysql3307/data --user=mysql
生成新的配置檔案:
vi /data/mysqldata/mysql3307/my.cnf
啟動例項:
mysqld_safe --defaults-file=/data/mysqldata/mysql3307/my.cnf
附上my.cnf內容:
[client]
port = 3307
socket = /data/mysqldata/mysql3307/mysqld.sock
[mysqld]
user = mysql
pid-file = /data/mysqldata/mysql3307/mysqld.pid
socket = /data/mysqldata/mysql3307/mysqld.sock
port = 3307
basedir = /data/mysqldata/mysql3307
datadir = /data/mysqldata/mysql3307/data
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 0.0.0.0
key_buffer = 16m
max_allowed_packet = 16m
thread_stack = 192k
thread_cache_size = 8
myisam-recover = backup
query_cache_limit = 1m
query_cache_size = 16m
#log_error = /data/mysqldata/mysql3307/error.log
expire_logs_days = 10
max_binlog_size = 100m
[mysqldump]
quick
quote-names
max_allowed_packet = 16m
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16m
[mysqld_safe]
syslog
skip-syslog=false
syslog-tag=3307
mysql啟動多例項 MySQL多例項啟動
一台伺服器安裝mysql,用於測試。同時會用於nextcloud和wordpress的資料庫。nextcloud和wordpress要經常備份,而且以後可能會遷移。所以隔離不同情景的資料,用多例項啟動。便於管理,和提高效能。首先初始化要用到的資料庫 mysqld initialize insecur...
mysql 5 7 10 啟動多例項筆記
原因 沒有加 應該是 datadir.示例 usr local mysql bin mysqld initialize insecure user mysql datadir data mysql3308data basedir usr local mysql usr local mysql bin...
mysql多例項命令 mysql多例項安裝
1 編輯my.cnf檔案增加相關引數如下 mysqld multi user root pass 123 mysqld usr local mysql bin mysqld safe mysqladmin usr local mysql bin mysqladmin log usr local my...