简述

因生产环境操作系统需要换成openEuler,所以所有的软件需要重新安装,其中在安装mysql5.7版本,执行初始化命令/data/mysql/bin/mysqld --defaults-file=/data/mysql/my.cnf --user=mysql --initialize时报错,报错如下

执行初始化命令/data/mysql/bin/mysqld --defaults-file=/data/mysql/my.cnf --user=mysql --initialize报错
mysqld: Can't create directory '/usr/local/mysql/data/' (Errcode: 2 - No such file or directory)
2024-02-04T07:32:12.702904Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2024-02-04T07:32:12.702978Z 0 [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.
2024-02-04T07:32:12.702984Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2024-02-04T07:32:12.703027Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2024-02-04T07:32:12.703737Z 0 [ERROR] Aborting

解决方式

修改初始化命令如下,然后重新执行,问题就可以解决

/data/mysql/bin/mysqld --defaults-file=/data/mysql/my.cnf --initialize-insecure --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data/
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐