Mysqld_multi Stop Bug
in BlogDatabaseMySQL with 0 comment

Mysqld_multi Stop Bug

in BlogDatabaseMySQL with 0 comment

最近在做mysqld_multi管理多实例的时候,发现stop不了节点
这是什么原因呢?
多实例相关配置如下:

[mysqld_multi]  
mysqld     = /usr/local/mysql/bin/mysqld_safe  
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /usr/local/mysql/mysqld_multi.log
user       = root
password   = shunzi

[mysqld3306]  
socket     = /data/mysql3306/tmp/mysql3306.sock
port       = 3306  
user       = mysql

pid-file   = /data/mysql3306/mysql3306.pid  
datadir    = /data/mysql3306/data
tmpdir     = /data/mysql3306/tmp

[mysqld3307]  
socket     = /data/mysql3307/tmp/mysql3307.sock
port       = 3307  
user       = mysql

pid-file   = /data/mysql3307/mysql3307.pid  
datadir    = /data/mysql3307/data
tmpdir     = /data/mysql3307/tmp

执行mysqld_multi stop 3306时日志报error:

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)'
mysqld_multi log file version 2.16; run: Thu Aug 31 21:09:02 2017

这里显示密码错误,手动登录是没有问题的。
这是mysqld_multi的一个bug,详细信息如下
https://bugs.mysql.com/bug.php?id=77227

解决方法是:

修改mysqld_multi文件中的defaults_for_group函数
        211 sub defaults_for_group
        212 {
        213   my ($group) = @_;
        214 
        215   return () unless $my_print_defaults_exists;
        216 
        217   my $com= join ' ', 'my_print_defaults', @defaults_options, $group;
        219   my @defaults = `$com`;
        220   chomp @defaults;
        221   return @defaults;
        222 }
        ==========================
    
        把 my $com= join ' ', 'my_print_defaults', @defaults_options, $group;
        替换为: my $com= join ' ', 'my_print_defaults -s', @defaults_options, $group;

在此记录一下!

Responses
点击这里给我发消息
嘿!有什么能帮到您的吗?