在修改配置之前,我们可以通过如下命令进行初始化数据库目录
bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var3306/
#
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
user = admin //数据库的账号
password = pwd_shutdown数据库的密码
[mysqld3306]
server-id = 3306
port = 3306
socket = /usr/local/mysql/tmp/mysql-3306.sock
pid-file = /usr/local/mysql/var3306/localhost.pid
log-error = /usr/local/mysql/var3306/localhost.err
datadir = /usr/local/mysql/var3306
log-slow-queries = /usr/local/mysql/var3306/slowquery.log
#slow_query_log_file = /usr/local/mysql/var3306/slowquery.log
skip-external-locking
skip-name-resolve
back_log = 256
key_buffer_size = 2048M
table_cache = 512K
max_allowed_packet = 16M
table_open_cache = 256
sort_buffer_size = 16M
myisam_sort_buffer_size = 512M
net_buffer_length = 1M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
join_buffer_size = 16M
thread_stack = 512K
query_cache_size = 128M
thread_concurrency = 16
character-set-server = GBK
wait-timeout = 31536000
max_connections = 10000
max_connect_errors = 10000000
#log-bin=mysql-bin
#binlog_format=mixed
long_query_time = 1
user = mysql
[mysqld3307]
server-id = 3307
port = 3307
socket = /usr/loca3307l/mysql/tmp/mysql-3307.sock
pid-file = /usr/local/mysql/var3307/localhost.pid
log-error = /usr/local/mysql/var3307/localhost.err
datadir = /usr/local/mysql/var3307
log-slow-queries = /usr/local/mysql/var3307/slowquery.log
#slow_query_log_file = /usr/local/mysql/var3307/slowquery.log
skip-external-locking
skip-name-resolve
back_log = 256
key_buffer_size = 2048M
table_cache = 512K
max_allowed_packet = 16M
table_open_cache = 256
sort_buffer_size = 16M
myisam_sort_buffer_size = 512M
net_buffer_length = 1M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
join_buffer_size = 16M
thread_stack = 512K
query_cache_size = 128M
thread_concurrency = 16
character-set-server = GBK
wait-timeout = 31536000
max_connections = 10000
max_connect_errors = 10000000
#log-bin=mysql-bin
#binlog_format=mixed
long_query_time = 1
user = mysql
[mysqld3308]
server-id = 3308
port = 3308
socket = /usr/local/mysql/tmp/mysql-3308.sock
pid-file = /usr/local/mysql/var3308/localhost.pid
log-error = /usr/local/mysql/var3308/localhost.err
datadir = /usr/local/mysql/var3308
log-slow-queries = /usr/local/mysql/var3308/slowquery.log
#slow_query_log_file = /usr/local/mysql/var3308/slowquery.log
skip-external-locking
skip-name-resolve
back_log = 256
key_buffer_size = 2048M
table_cache = 512K
max_allowed_packet = 16M
table_open_cache = 256
sort_buffer_size = 16M
myisam_sort_buffer_size = 512M
net_buffer_length = 1M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
join_buffer_size = 16M
thread_stack = 512K
query_cache_size = 128M
thread_concurrency = 16
character-set-server = GBK
wait-timeout = 31536000
max_connections = 10000
max_connect_errors = 10000000
#log-bin=mysql-bin
#binlog_format=mixed
long_query_time = 1
user = mysql
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout