mysql 修改默认存储位置

[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
datadir=/opt/tools/mysql
socket=/opt/tools/mysql/mysql.sock
user=mysql
default-character-set=utf8
log-slow-queries = /opt/logs/mysql/slowquery.log
long_query_time = 1  #单位是秒
log-queries-not-using-indexes

# Disabling symbolic-links is recommended to prevent assorted security risks
set-variable=max_connections=1000
max_allowed_packet=20M
innodb_buffer_pool_size=1G
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysql.server]
user=mysql
basedir=/opt/tools/mysql

[client]
#用来让本机客户端连接的,否则本机连接就会报找不到 /var/lib/mysql/mysql.sock 错误
socket=/opt/tools/mysql/mysql.sock


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

你可能感兴趣的:(mysql 修改默认存储位置)