Mysql多个实例无法通过套接字连接

时间:2018-02-07 18:25:36

标签: mysql sockets

my.conf

[mysqld]

datadir=/var/lib/mysql/mysql
socket=/var/lib/mysql/mysql.sock

[mysqld@1]

socket          = /var/run/mysqld/mysqld1.sock
datadir         = /var/lib/mysql/mysql1

我可以mysql -u root -p连接,但当我想连接到mysql --socket=/var/run/mysqld/mysqld1.sock -u root -p之类的第二个实例时,我有ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)。我多次检查密码是否正确。

centos 7

1 个答案:

答案 0 :(得分:1)

我只需要使用mysqladmin --socket=path_to_socket -u root -p'temporary password from logs' password new_password

设置root密码