mysql_secure_installation报错Error: Can't connect to local MySQL server through socket '/data/mysql/mysql.sock' 解决
MySQL重新初始化以后,使用mysql_secure_installation报错找不到mysql.sock文件,地址是老的文件地址:
[root@kgoatestdb mysql_logs]# mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'default-character-set=utf8'
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/data/mysql/mysql.sock' (2)
解决办法如下:
my.cnf参数文件里面修改新地址:
[client]
default-character-set = utf8
port = 3306
socket = /home/mysql/data/mysql.sock
其他省略..
设置MYSQL_UNIX_PORT变量:
export MYSQL_UNIX_PORT=/home/mysql/data/mysql.sock
后面在运行mysql_secure_installation就可以了。
Tag标签:「mysql8 mysql_secure_installation」更新时间:「2023-07-20 15:25:21」阅读次数:「1128」