系统版本:SUSE Linux Enterprise Server 12 SP5
安装的mysql版本:mysql-5.7.29-1.sles12.x86_64.rpm-bundle.tar
安装完之后修改/etc/my.cfg 文件
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
port=3306
socket=/var/lib/mysql/mysql.sock
user=mysql
datadir=/data/mysql/data
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/data/mysql/mysql.log
pid-file=/data/mysql/mysql.pid
里面的pid-file无法修改成自定义的路径/data/mysql/mysql.pid
还是会自动在/run/mysql下面生成mysqld.pid
socket如果改成/data/mysql/mysql.sock
就会造成无法用 mysql -uroot -p 的命令登陆
linux-97m8:/data/mysql/data # mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
只能用 mysql -h 127.0.0.1 -uroot -p 这个方式
linux-97m8:/data/mysql/data # mysql -h 127.0.0.1 -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.29