1. MySQL5.7.21启动时报错:
[ERROR] Can't find error-message file '/data/mysql/3307/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2. 登录MySQL查看系统全局参数:
mysql> show global variables like '%messages%';
+-----------------+-----------------------+
| Variable_name | Value |
+-----------------+-----------------------+
| lc_messages | en_US |
| lc_messages_dir | /data/mysql/share/ |
+-----------------+-----------------------+
3. 然后发现lc_messages_dir的目录在/data/mysql/share/, 然后到系统层面查看
[root@Master mysql]# ll
total 4
drwxr-xr-x 6 mysql mysql 4096 Aug 31 11:47 3307
4. 从系统相应路径下并没有发现share目录,然后还是在系统层面找errmsg.sys文件
[root@Master mysql]# find / -name errmsg.sys
/opt/mysql3307/share/serbian/errmsg.sys
/opt/mysql3307/share/dutch/errmsg.sys
/opt/mysql3307/share/russian/errmsg.sys
/opt/mysql3307/share/swedish/errmsg.sys
/opt/mysql3307/share/portuguese/errmsg.sys
/opt/mysql3307/share/english/errmsg.sys
/opt/mysql3307/share/italian/errmsg.sys
/opt/mysql3307/share/czech/errmsg.sys
/opt/mysql3307/share/ukrainian/errmsg.sys
/opt/mysql3307/share/estonian/errmsg.sys
/opt/mysql3307/share/norwegian-ny/errmsg.sys
/opt/mysql3307/share/korean/errmsg.sys
/opt/mysql3307/share/french/errmsg.sys
/opt/mysql3307/share/spanish/errmsg.sys
/opt/mysql3307/share/hungarian/errmsg.sys
/opt/mysql3307/share/greek/errmsg.sys
/opt/mysql3307/share/german/errmsg.sys
/opt/mysql3307/share/polish/errmsg.sys
/opt/mysql3307/share/japanese/errmsg.sys
/opt/mysql3307/share/romanian/errmsg.sys
/opt/mysql3307/share/norwegian/errmsg.sys
/opt/mysql3307/share/bulgarian/errmsg.sys
/opt/mysql3307/share/slovak/errmsg.sys
/opt/mysql3307/share/danish/errmsg.sys
5. 查询了下mygtid.cnf当中并没有设定此参数,然后就把lc-messages-dir加入到mygtid.cnf当中
[root@Master mysql]# cat /data/mysql/3307/conf/mygtid.cnf
[mysqld]
##########basic settings###################
port = 3307
bind-address = 0.0.0.0
basedir = /data/mysql/3307
datadir = /data/mysql/3307/data
socket = /data/mysql/3307/mysql.sock
lc-messages = en_US
lc-messages-dir = /opt/mysql3307/share
6. 关闭MySQL实例(因为lc-messages-dir系统参数只能在实例启动的时候修改;lc-messages是动态参数可在线调整)
[root@Master mysql]# /opt/mysql3307/bin/mysqladmin -uroot -p -S /data/mysql/3307/mysql.sock shutdown
7. 重新启动MySQL实例
[root@DCSDR213 mysql]# /opt/mysql3307/bin/mysqld --defaults-file=/data/mysql/3307/conf/mygtid.cnf &
8. 查看lc-messages-dir参数
9. 此时error.log当中没有发现报错了
参考:
https://dev.mysql.com/doc/refman/5.7/en/error-message-language.html