Cannot create test file cant create test file /usr/local/mysql8.0...

Encountered such a problem when reinstalling mysql

020-03-11T22:25:40.586329Z 0 [System] [MY-010116] [Server] /usr/local/mysql-8.0.19-macos10.15-x86_64/bin/mysqld (mysqld 8.0.19) starting as process 18261
2020-03-11T22:25:40.606916Z 0 [Warning] [MY-010091] [Server] Can't create test file /usr/local/mysql-8.0.19-macos10.15-x86_64/data/mysqld_tmp_file_case_insensitive_test.lower-test
2020-03-11T22:25:40.606933Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql-8.0.19-macos10.15-x86_64/data/ is case insensitive
2020-03-11T22:25:40.607132Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to '/usr/local/mysql-8.0.19-macos10.15-x86_64/data/' (OS errno: 13 - Permission denied)
2020-03-11T22:25:40.607199Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-03-11T22:25:40.607416Z 0 [System] [MY-010910] [Server] /usr/local/mysql-8.0.19-macos10.15-x86_64/bin/mysqld: Shutdown complete (mysqld 8.0.19)  MySQL Community Server - GPL.

It’s really a tricky question. It took a long time to find some clues in the internal and external networks\. First, you need to modify the directory permissions.

sudo chown -R 你的主机名 /usr/local/mysql-8.0.20-macos10.15-x86_64/data

Then delete the data folder (not empty) under the mysql-8.0.20-macos10.15-x86_64 folder, and create a new empty data folder

Finally, run the following command in the mysql-8.0.20-macos10.15-x86_64/bin directory

./mysqld --initialize --lower-case-table-names=1

The result of the operation is like this 

Open Navicat and try to connect to the database

Finally succeeded~ 

Guess you like

Origin blog.csdn.net/promiseCao/article/details/106974868