How to restore the Mysql database and mysql database after the computer reinstalls the system

Source: Internet
Author: User

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!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.