[mysqld_multi] mysqld=/usr/bin/mysqld_safe mysqladmin=/usr/bin/mysqladmin user=AAA password=BBB [mysqld3306] port=3306 datadir=/var/lib/mysql3306 socket=/var/lib/mysql3306/mysql.sock pid-file=/var/lib/mysql3306/mysqld.pid log-error=/var/log/mysqld_3306.log user=mysql symbolic-links=0 character-set-server = utf8 skip-name-resolve server-id=123 log-bin=mysql-bin log-slave-updates binlog-ignore-db=mysql binlog-ignore-db=test binlog-ignore-db=information_schema binlog-ignore-db=performance_schema replicate-ignore-db=mysql replicate-ignore-db=test replicate-ignore-db=information_schema replicate-ignore-db=performance_schema master-connect-retry=10 max_connections=1000 sort_buffer_size = 300M join_buffer_size = 300M key_buffer_size = 300M innodb_buffer_pool_size = 4000M query_cache_size=200M
注意, 要配置 user 和 password, 一会将要创建一个帐号用于 mysqld_multi.
sudo mysql_install_db --datadir=/var/lib/mysql3306 --user=mysql
/etc/init.d/mysqld_multi start mysql3306
修改 root 密码要用到 /usr/bin/mysql_secure_installation 脚本, 但这个脚本默认是通过 /var/run/mysql.sock 本地连接. 所以不对, 你需要修改它.
make_config() { echo "# mysql_secure_installation config file" >$config echo "[mysql]" >>$config echo "user=root" >>$config echo "host=127.0.0.1" >>$config echo "port=3306" >>$config esc_pass=`basic_single_escape "$rootpass"` echo "password='$esc_pass'" >>$config #sed 's,^,> ,' < $config # Debugging }
GRANT SHUTDOWN ON *.* TO 'AAA'@'localhost' IDENTIFIED BY 'BBB';