MySQL PXC 5.7 invalid user‘@MYSQLD_USER@’

  1. 云栖社区>
  2. 博客>
  3. 正文

MySQL PXC 5.7 invalid user‘@MYSQLD_USER@’

leshami 2017-12-28 11:14:22 浏览1085
展开阅读全文

最近的PXC 5.7启动的时候收到一个无效用户的提示,invalid user ‘@MYSQLD_USER@’,这个问题还真是头一次碰到,而且这个MYSQLD_USER压根也是一个不存在的用户,到底是哪里的问题呢?见下文描述及其解决方案。

一、故障现象

[root@pro-db-8 pxcdata]# systemctl start mysql@bootstrape
Job for mysql@bootstrape.service failed because a configured resource limit was exceeded. 
See "systemctl status mysql@bootstrape.service" and "journalctl -xe" for details.

-- 故障环境
[root@pro-db-8 pxcdata]# more /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@pro-db-8 pxcdata]# mysql -V
mysql Ver 14.14 Distrib 5.7.19-17, for Linux (x86_64) using 6.2

二、故障排查

[root@pro-db-8 pxcdata]# journalctl -xe
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Dec 15 13:26:25 pro-db-8 systemd[1]: Unit mysql.service entered failed state.
Dec 15 13:26:25 pro-db-8 systemd[1]: mysql.service failed.
Dec 15 13:26:25 pro-db-8 polkitd[533]: Unregistered Authentication Agent for unix-process:32110:501725444 
(system bus name :1.22670, object path /org/freedesktop/PolicyKit1/Authenticati
Dec 15 13:26:57 pro-db-8 sshd[32168]: Connection closed by 10.80.234.38 [preauth]
Dec 15 13:27:21 pro-db-8 polkitd[533]: Registered Authentication Agent for unix-process:32178:501731024
 (system bus name :1.22671 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object 
Dec 15 13:27:21 pro-db-8 systemd[1]: Starting Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrap...
-- Subject: Unit mysql@bootstrap.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql@bootstrap.service has begun starting up.
Dec 15 13:27:21 pro-db-8 mysql-systemd[32184]: install: invalid user ‘@MYSQLD_USER@’ --这里是错误信息
Dec 15 13:27:21 pro-db-8 systemd[1]: mysql@bootstrap.service: control process exited, code=exited status=1
Dec 15 13:27:21 pro-db-8 systemd[1]: Failed to start Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrap.
-- Subject: Unit mysql@bootstrap.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql@bootstrap.service has failed.
-- 
-- The result is failed.
Dec 15 13:27:21 pro-db-8 systemd[1]: Unit mysql@bootstrap.service entered failed state.
Dec 15 13:27:21 pro-db-8 systemd[1]: mysql@bootstrap.service failed.
Dec 15 13:27:21 pro-db-8 polkitd[533]: Unregistered Authentication Agent for unix-process:32178:501731024
 (system bus name :1.22671, object path /org/freedesktop/PolicyKit1/Authenticati
Dec 15 13:27:34 pro-db-8 polkitd[533]: Registered Authentication Agent for unix-process:32230:501732336
 (system bus name :1.22672 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object 
Dec 15 13:27:34 pro-db-8 systemd[1]: Failed to load environment files: No such file or directory
Dec 15 13:27:34 pro-db-8 systemd[1]: mysql@bootstrape.service failed to run 'start-pre' task: No such file or directory
Dec 15 13:27:34 pro-db-8 systemd[1]: Failed to start Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrape.
-- Subject: Unit mysql@bootstrape.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql@bootstrape.service has failed.
-- 
-- The result is failed.
Dec 15 13:27:34 pro-db-8 systemd[1]: mysql@bootstrape.service failed.
Dec 15 13:27:34 pro-db-8 systemd[1]: Starting Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrape...
-- Subject: Unit mysql@bootstrape.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql@bootstrape.service has begun starting up.
Dec 15 13:27:34 pro-db-8 polkitd[533]: Unregistered Authentication Agent for unix-process:32230:501732336
 (system bus name :1.22672, object path /org/freedesktop/PolicyKit1/Authenticati

-- 通过status查看相关信息
[root@pro-db-8 pxcdata]# systemctl status mysql@bootstrap.service
● mysql@bootstrap.service - Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrap
  Loaded: loaded (/usr/lib/systemd/system/mysql@.service; disabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Fri 2017-12-15 13:28:24 CST; 6s ago
  Process: 32256 ExecStartPre=/usr/bin/mysql-systemd start-pre (code=exited, status=1/FAILURE)

## Author : Leshami
## Blog   : http://blog.csdn.net/leshami
Dec 15 13:28:24 pro-db-8 systemd[1]: Starting Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrap...
Dec 15 13:28:24 pro-db-8 mysql-systemd[32256]: install: invalid user ‘@MYSQLD_USER@’  --错误信息
Dec 15 13:28:24 pro-db-8 systemd[1]: mysql@bootstrap.service: control process exited, code=exited status=1
Dec 15 13:28:24 pro-db-8 systemd[1]: Failed to start Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrap.
Dec 15 13:28:24 pro-db-8 systemd[1]: Unit mysql@bootstrap.service entered failed state.
Dec 15 13:28:24 pro-db-8 systemd[1]: mysql@bootstrap.service failed.

三、解决方案

Google到这是一个5.7 PXC的Bug,也就是说当mysql的错误日志文件不存在的时候,会产生这个无效用户的错误
下面我们创建这个错误日志文件,注意,日志文件名应与my.cnf中配置一致
[root@pro-db-8 pxcdata]# touch /var/log/mysqld.log

[root@pro-db-8 pxcdata]# chown mysql:mysql /var/log/mysqld.log 

--再次启动正常
[root@pro-db-8 pxcdata]# systemctl start mysql@bootstrap.service 
[root@pro-db-8 pxcdata]# ps -ef|grep mysql
mysql      573 32509  3 13:37 ?        00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/u02/pxcdata
--plugin-dir=/usr/lib64/mysql/plugin --user=mysql --wsrep-provider=/usr/lib64/galera3/libgalera_smm.so 
--wsrep-new-cluster --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid 
--socket=/var/lib/mysql/mysql.sock --wsrep_start_position=00000000-0000-0000-0000-000000000000:-1
root      627 30055  0 13:37 pts/0    00:00:00 grep --color=auto mysql
root    32509    1  0 13:37 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr  --wsrep-new-cluster 

[root@pro-db-8 pxcdata]# netstat -nltp|grep mysql
tcp        0      0 0.0.0.0:4567            0.0.0.0:*              LISTEN      573/mysqld          
tcp6      0      0 :::3306                :::*                    LISTEN      573/mysqld        

四、更多参考

https://bugs.launchpad.net/percona-xtradb-cluster/+bug/1724811

网友评论

登录后评论
0/500
评论
leshami
+ 关注