码迷,mamicode.com
首页 > 数据库 > 详细

mysql 5.7.12----bin/mysqld --initialize --user=mysql出错

时间:2016-04-28 12:12:09      阅读:4464      评论:0      收藏:0      [点我收藏+]

标签:

我最近在安装mysql 5.7.12,本来之前安装mysql 5.7.11时用命令

bin/mysqld --initialize --user=mysql

可以很好的初始化,但是用在5.7.12版本居然报错

[root@centos mysql-5.7.12]# bin/mysqld --initialize --user=mysql
2016-04-28T09:50:25.142068Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-28T09:50:25.142323Z 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.
2016-04-28T09:50:25.144865Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2016-04-28T09:50:25.144934Z 0 [ERROR] Aborting

后来发现centos自带的/etc/my.cnf和/etc/mysql没有删掉,后来删掉这两个文件之后在此使用这个命令

仍然报错

mysqld: Can‘t create directory ‘/usr/local/mysql/data/‘ (Errcode: 2 - No such file or directory)
2016-04-28T09:53:24.465575Z 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.
2016-04-28T09:53:24.467928Z 0 [ERROR] Aborting

后来在网上一查发现使用mysqld命令时要初始化

应该在mysql祝文件夹下创建data文件,但是记得在5.7.11版本里面的data文件是自动生成的

mkdir data

然后执行下面一句

bin/mysqld --user=mysql --basedir=/usr/local/mysql-5.7.12 --datadir=/usr/local/mysql-5.7.12/data/  --initialize

2016-04-28T10:01:07.730549Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-28T10:01:08.194212Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-04-28T10:01:08.725913Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-04-28T10:01:08.810579Z 0 [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: 213135a4-0d28-11e6-b869-000c299613e3.
2016-04-28T10:01:08.816207Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2016-04-28T10:01:08.819712Z 1 [Note] A temporary password is generated for root@localhost: %?kTFF<e8XXL

这算是成功了把,给出了初始密码,接下来把support-files/my-default.cnf复制到/etc/下,并配置一下

就可以了!

mysql 5.7.12----bin/mysqld --initialize --user=mysql出错

标签:

原文地址:http://www.cnblogs.com/tuhooo/p/5441947.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!