什么导致错误的关于' lc-messages-dir'当我初始化mysql-5.7.17时

时间:2017-01-05 06:35:49

标签: mysql

[root@wwwlxg bin]# ./mysqld --initialize --user=mysql --basedir=/opt/mysql/mysql --datadir=/opt/mysql/mysql/data
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
[Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.

[ERROR] Can't find error-message file '/opt/mysql/mysql/data/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
[Warning] InnoDB: New log files created, LSN=45790
[Warning] InnoDB: Creating foreign key constraint system tables.
[Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 73963455-d30a-11e6-bf4f-3aa0c659e827.
[Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
[Note] A temporary password is generated for root@localhost: t&VhwEgod4rm

<小时/> 这是my.cnf

# These are commonly set, remove the # and set as required.
 basedir = /opt/mysql/
datadir = /opt/mysql/data
 port = 3306
server_id = 1
socket = /tmp/mysql.sock
lc_messages_dir = /opt/mysql/data
language = /opt/mysql/share/english
  

有关于&#39; lc-messages-dir&#39;的错误我想知道那是什么以及如何解决它?(这个问题已经解决了)因为我将它添加到my.cnf:lc_messages_dir = / opt / mysql / data

当mysql.server启动时出现

另一个错误

ps -ef|grep mysql
no other mysql is running 
ls -l /opt/mysql
im sure /opt/mysql is  mysql:mysql
Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/wwwlxg.pid).
  

即时运行:centos6.4 mysql-5.7.17-linux-glibc2.5-x86_64

4 个答案:

答案 0 :(得分:1)

的my.cnf

[mysqld]
...
lc_messages_dir = /opt/mysql/share
lc_messages = en_US

errmsg.sys通常位于/ {mysql-path} / mysql / share / {language} /,{language}将是'english','spanish'...

了解更多详情:http://dev.mysql.com/doc/refman/5.7/en/error-message-language.html

答案 1 :(得分:1)

您必须在一行中将--defaults-file =#作为第一个参数,如下所示:

./bin/mysqld  --defaults-file=my57.cnf --initialize

查看更多:https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html

希望对您有所帮助:)

答案 2 :(得分:0)

看起来文件errmsg.sys的路径不存在。 检查文件夹/opt/mysql/mysql/data是否存在,如果不存在,请创建它。 也许您还必须使用chown mysql:mysql /opt/mysql/mysql/data调整此文件夹的权限。

答案 3 :(得分:0)

通常,在安装MySQL时,通常会在/ usr / share / mysql-中在系统中创建用于lc_messages配置的目录。

my.cnf 中为此的正确配置如下(在我的情况下为MySQL 8.0):

[mysqld]
lc-messages-dir                         = /usr/share/mysql-8.0
lc-messages                             = en_US

如果直接在lc-message-dir中指定 errmsg.sys 所在的语言(例如/usr/share/mysql-8.0/english),那么您将收到以下警告:

使用5.5之前的语义从中加载错误消息 /usr/share/mysql-8.0/english/。如果这不是故意的,请参阅 有效使用--lc-messages-dir和--language的文档 参数。

关键是正确使用 lc-messages-dir lc-messages