搭建好mysql多实例环境之后,想要通过mysqld_multi stop停掉MySQL服务,但是执行该命令无效,mysql依旧正常运行
关于mysql多实例环境部署可参考博文:MySQL多实例环境部署
日志报错如下:
Stopping MySQL servers
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
mysqld_multi log file version 2.16; run: Thu Jun 28 14:47:48 2018
原因分析:
通过看上面的报错信息,可以看出,肯定是mysqladmin无法登录的问题
解决方法:
原因是在my.cnf文件的中没有配置user和pass导致的,加上之后就可以了
my.cnf配置文件内容如下
[mysqld_multi]
user=root
pass=XXXXX //需要注意的是,是pass而不是password
mysqld=/usr/local/mysql/bin/mysqld_safe
mysqladmin=/usr/local/mysql/bin/mysqladmin
log=/data/mysql/mysqld_multi.log
[mysqld]
#skip-grant-tables
user=mysql
basedir = /usr/local/mysql
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld3306]
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/data/mysql/mysql_3306/data/
socket=/tmp/mysql3306.sock
port=3306
server_id=3306
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/mysql_3306/log/slow.log
log-error = /data/mysql/mysql_3306/log/error.log
binlog_format = mixed
log-bin = /data/mysql/mysql_3306/log/mysql3306.bin
关于mysql更多的学习可参考作者的博客:
http://blog.itpub.net/31015730/cid-184172-list-1/
作者:SEian.G(苦练七十二变,笑对八十一难)