1. 程式人生 > 其它 >mysqld_multi停止資料庫時報錯:‘Access denied for user ‘root‘@‘localhost‘

mysqld_multi停止資料庫時報錯:‘Access denied for user ‘root‘@‘localhost‘

技術標籤:資料庫mysql資料庫

問題現象

[email protected]:~$ /home/mysql/mysql-multi/bin/mysqld_multi --defaults-extra-file=/home/mysql/mysql-multi/my.cnf stop 1-2
mysqld_multi log file version 2.16; run: Sun Jan  3 23:50:03 2021
Stopping MySQL servers
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
[email protected]
:~$

解決方法

[email protected]:~$ vi /home/mysql/mysql-multi/bin/mysqld_multi 

將mysqld_multi 的第216行my_print_defaults後新增“-s”

my $com= join ' ', 'my_print_defaults', @defaults_options, $group;

修改為

my $com= join ' ', 'my_print_defaults -s', @defaults_options, $group;

然後儲存推出即可

[email protected]
:~$ /home/mysql/mysql-multi/bin/mysqld_multi --defaults-extra-file=/home/mysql/mysql-multi/my.cnf report mysqld_multi log file version 2.16; run: Mon Jan 4 07:27:55 2021 Reporting MySQL servers MySQL server from group: mysqld1 is running MySQL server from group: mysqld2 is not running [email protected]:~$ /home/mysql/mysql-multi/bin/mysqld_multi --defaults-extra-file=/home/mysql/mysql-multi/my.cnf stop 1 mysqld_multi log file version 2.16; run: Mon Jan 4 07:28:08 2021 Stopping MySQL servers mysqladmin: [Warning] Using a password on the command line interface can be insecure.
[email protected]
:~$ mysqladmin: [Warning] Using a password on the command line interface can be insecure. mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/tmp/inst1.sock' (2)' Check that mysqld is running and that the socket: '/tmp/inst1.sock' exists! 2021-01-04T15:28:09.424091Z mysqld_safe mysqld from pid file /home/mysql/mysql-multi/data/inst1/mysqld.pid ended [email protected]:~$ /home/mysql/mysql-multi/bin/mysqld_multi --defaults-extra-file=/home/mysql/mysql-multi/my.cnf report WARNING: Log file disabled. Maybe directory or file isn't writable? mysqld_multi log file version 2.16; run: Mon Jan 4 07:28:17 2021 Reporting MySQL servers MySQL server from group: mysqld1 is not running MySQL server from group: mysqld2 is not running [email protected]:~$