In mysql, you can use the "mysqld --initialize-insecure --user=mysql" command to solve the problem; this command can automatically create a data folder in the bin directory of the MySQL installation directory. This folder Used to store database information.
The operating environment of this tutorial: windows10 system, mysql5.7 version, Dell G3 computer.
When installing mysql 5.7 version, if you find that the data folder is missing due to the root directory,
Do not copy other versions data folder
Because this operation will cause many potential problems: For example, when executing the show variables like "%charact%"; statement, the error table does not exist!
Open the cmd command window and enter the bin directory of the mysql installation directory.
Then enter the command (note: there is a space in front of all --. It is recommended to copy directly, do not enter the command yourself to prevent losing the space):
mysqld --initialize-insecure --user=mysql
Then press Enter; Go to the directory and check that the data folder has been automatically created.
Problem Solving
Recommended learning: mysql video tutorial
The above is the detailed content of What should I do if mysql does not have a data folder?. For more information, please follow other related articles on the PHP Chinese website!