MySQL PXC 5.7 invalid user‘@MYSQLD_USER@’

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用系列 2核4GB
简介:

最近的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

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
7月前
|
关系型数据库 MySQL
ERROR 1449 (HY000): The user specified as a definer (‘mysql.infoschema‘@‘localhost‘) does not exist
ERROR 1449 (HY000): The user specified as a definer (‘mysql.infoschema‘@‘localhost‘) does not exist
180 0
|
4月前
|
SQL 关系型数据库 MySQL
mysql密码错误-ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using passwor:yes)
这篇文章提供了解决MySQL数据库"Access denied for user 'root'@'localhost' (using password: YES)"错误的方法,通过跳过密码验证、修改root密码,然后重启服务来解决登录问题。
mysql密码错误-ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using passwor:yes)
|
7月前
|
关系型数据库 MySQL 数据库连接
解决 mysql8.0 ERROR 1045 (28000): Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)用户访问拒绝
解决 mysql8.0 ERROR 1045 (28000): Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)用户访问拒绝
2187 52
解决 mysql8.0 ERROR 1045 (28000): Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)用户访问拒绝
|
5月前
|
缓存 监控 关系型数据库
MySQL PXC 集群死锁分析案例
前不久一个系统死锁导致部分业务受到影响,今次补上详细的节点日志分析过程。
99 1
|
6月前
|
关系型数据库 MySQL
mysql导入报错1067 – Invalid default value for
mysql导入报错1067 – Invalid default value for
166 5
|
5月前
|
负载均衡 关系型数据库 MySQL
MySQL PXC集群多个节点同时大量并发update同一行
如本文标题,MySQL PXC集群多个节点同时大量并发update同一行数据,会怎样? 为此,本人做了一个测试,来验证到底会怎样!
54 0
|
5月前
|
网络协议 关系型数据库 MySQL
【最佳实践】MySQL数据库迁移到PXC集群
借本次数据库迁移实践,再次总结一下MySQL数据库迁移到PXC的最佳操作路径。
103 0
|
5月前
|
网络协议 关系型数据库 MySQL
MySQL PXC集群配置IPv6
前阵子为PXC集群配置IPv6支持,遇见奇怪的问题,就是SST同步时总是报错,为此在官网论坛提交了问题,未得到答案,最后偶然得到了答案
50 0
|
6月前
|
SQL 关系型数据库 MySQL
已解决:mysql报错> 1067 - Invalid default value for ‘comment_date‘ [DTF] 2> wp_links: Getting
已解决:mysql报错> 1067 - Invalid default value for ‘comment_date‘ [DTF] 2> wp_links: Getting
99 5
|
5月前
|
关系型数据库 MySQL Go
mysql,数据库Server returns invalid timezone. Go to ‘Advanced‘ tab 数据库的行和列没有出现怎么办p
mysql,数据库Server returns invalid timezone. Go to ‘Advanced‘ tab 数据库的行和列没有出现怎么办p