How to restore the Mysql database and mysql database after the computer reinstalls the system
How to restore a computer after reinstalling the systemMysqlDatabase
1. [set mysql path]
For example, my mysql in: D: \ DataBase \ mysql-5.7.13-winx64, you can create an environment variable Mysql_Home in the environment variables, the variable value is the installation directory of Mysql
Then, add; % Mysql % \ bin; In the Path variable value ;,
2. [test]
Win + R, Enter cmd, and enter mysql admin-V in the command line window. If the following information is displayed, the environment variable is successfully configured!
3. [Change basedir and datadir]
In this step, the current mysql installation directory and the previous changes have occurred. If there is no change, enter mysqld to start mysql, open a command line window, and enter: mysql-u [user]-p [password] can log on to mysql, and then use show databases to find that the database table is still the original table! Not changed.
Unfortunately, you have changed your mysql installation directory, which is also very simple. There is a file under the mysql installation directory: my. ini
Open,
Found that the directory is still the previous installation directory and database directory, You need to manually change to the current directory, if there is no such file can copy a my-default.ini and renamed to my. ini, and then modify the corresponding content.
Iv. [ultimate test]
This is to open the command window. Enter mysqld to start mysql. Then open another window and enter mysql-u [user]-p [password].
Connection successful!
V. [Register mysql to the System Service]
This step does not need to be done. If your mysql is just for personal use, it is unnecessary. If it is used as a server or registered as a system service, in this way, the service is opened when the system is started. It is also easy to open the command window and enter mysqld install! Open the service and find that there is another Mysql service. The service is successfully registered!