部署LNMP架构时安装MySQL的报错(--initialize specified but the data directory has files in it. Aborting.)!
Posted handsomeboy-东
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署LNMP架构时安装MySQL的报错(--initialize specified but the data directory has files in it. Aborting.)!相关的知识,希望对你有一定的参考价值。
mysql数据库装完了,准备初始化数据库时出现问题“–initialize specified but the data directory has files in it. Aborting.”
[root@localhost mysql]# bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2021-06-22T16:41:37.699189Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-06-22T16:41:37.700235Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2021-06-22T16:41:37.700254Z 0 [ERROR] Aborting
错误原因,这是我的mysql数据库已经初始化过,但是代码敲错出现问题,而我们不能再用这个进行初始化,解决方法:
vim /etc/my.cnf #找到以下位置的文件,并删除它
[root@localhost mysql]# rm -rf /usr/local/mysql/data
#### 再重新初始化系统即可
[root@localhost mysql]# bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2021-06-22T16:56:03.767918Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-06-22T16:56:04.014610Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-06-22T16:56:04.062964Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-06-22T16:56:04.119111Z 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: baf795ee-d37a-11eb-80d4-000c2908133d.
2021-06-22T16:56:04.120460Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-06-22T16:56:04.121173Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
以上是关于部署LNMP架构时安装MySQL的报错(--initialize specified but the data directory has files in it. Aborting.)!的主要内容,如果未能解决你的问题,请参考以下文章