[error] – initialize specified but the data directory has files in it. About.:
Problem Description:
MySQL is installed in Linux. Because it has been installed and uninstalled before, the uninstallation is not clean. When installing again, the following error occurs when initializing the password
2021-11-23T02:08:16.247240Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-11-23T02:08:16.248753Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2021-11-23T02:08:16.248780Z 0 [ERROR] Aborting
Cause analysis:
reason: the old version of MySQL software does not delete the original data file, that is, the content under the path/var/lib/MySQL/
Solution: delete all contents under the path, including files and folders.
[root@hadoop102 mysql]# rm -rf /var/lib/mysql/
After successful execution, initialize the password:
[root@hadoop102 opt]# mysqld --initialize --user=mysql
[root@hadoop102 opt]# cat /var/log/mysqld.log
2021-11-23T02:17:47.821574Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-11-23T02:17:47.988844Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-11-23T02:17:48.010498Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-11-23T02:17:48.066559Z 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: 8d49959d-4c03-11ec-be82-000c29bdc989.
2021-11-23T02:17:48.067296Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-11-23T02:17:48.067886Z 1 [Note] A temporary password is generated for root@localhost: UBX6u)ekR:kB
Because there is no data saved in my data, direct deletion will not affect subsequent tasks, but!!! If you have data, you must back it up first~
Read More:
- MySQL Error: [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file
- [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata
- Error 1406 (22001) in MySQL: data too long for column (Fixed)
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- [Solved] MySQL Notifier Error Cannot Initialize Main Application
- How to Solve Mysql8 load data error
- MYSQL Slave is not configured or failed to initialize properly. You must at least set –server-id
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- [Solved] Error in MySQL installation in Linux: failed dependencies xxxxx
- Centos7 Initialize mysql Error: Could not open file ‘/usr/local/mysql/log/mysqld.log‘ for error logging: Per
- [Solved] workbench ssl connection error ssl is required but the server
- scm_prepare_database.sh CDH initial data script execute error
- [Solved] Python import Error: pip –upgrade Error: ERROR: Cannot uninstall ‘dnspython‘. It is a distutils installed
- ERROR 1075 (42000) Incorrect table definition; there can be only one auto column and it must be defi
- linux mysql ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
- ERROR 1265 (01000): Data truncated for column ‘ENABLED’ at row 7
- [Solved] there are special symbols in the initial password for installing MySQL in Hadoop, and an error is reported
- ERROR 1261 (01000): Row 1 doesn‘t contain data for all columns
- Elasticsearch imports MySQL data Error when executing the bin/logstash – f command
- [Solved] com.mysql.jdbc.MysqlDataTruncation: Data truncation xxxx