MySQL database custom path installation and data migration
Background: The platform environment was deployed before the site, in which MySQL (version: MySQL57) was installed. At that time, MySQL was installed in the default path, which is the C drive. Now, at the request of the owner, the C drive is the system drive, the D drive is installed software, and the E drive is stored. data, F drive stores backup files, etc. So to reinstall MySQL and need to keep the original data, I will record the overall steps below:
Operation steps:
1. Dump the original database file and make a backup (this step is just to ensure data security and will not be used later)
2. Copy the Data folder of ProgramData\MySQL\MySQL Server 5.7 under the C drive (the default data storage path)
3. Stop the MySQL service
4. Uninstall the
MySQL program in the program and function of uninstalling mysql57
5. To install MySQL
, you need to install the VC2013 runtime library. Download address: http://www.downza.cn/soft/195421.html
Installation graphic tutorial: https://editor. csdn.net/md?not_checkout=1&articleId=108463490
1),
2),
3), only select the installation service, according to the number of digits of the computer system, mine is 64 bits, so choose the first
4), select the right side with the mouse service, the modification option to update the installation location appears at the bottom right.
5), the path modification interface
Note: It must be noted here that the selected path must have permissions. If there is no permission, it cannot be installed. You need to find the corresponding path folder and right-click Properties-Security option, add full control permissions for all users
6),
7)、
8),
9), the default port is 3306, you can modify it by yourself
10), after filling in the password here, there may be a yellow exclamation mark, return to the previous step and come back to fill in again
11),
12),
13),
14),
15),
16), the last step, get it done
17), go to the service to check whether the MySQL57 service is available and started, and then connect and check through the Navicat tool
6. The path after installation is as follows:
1. Program installation path: D:\Program Files\MySQL\MySQL Server 5.7
2. Data storage path: D:\ProgramData\MySQL\MySQL Server 5.7\Data are
all installed in D Disk, is to demonstrate how to migrate the data storage location.
It is also possible to directly change the storage location to E disk during
installation
. Copy the Data folder under \ to Disk E, such as the root directory of Disk E
9. Modify the my.ini file under D:\ProgramData\MySQL\MySQL Server 5.7\, and change the path to the path of the Data folder on Disk E
10. Restart the mysql57 service
. 11. Verify whether the E disk storage is effective
Create a new database, such as: test, and check whether the generated new library folder is generated under the D disk or the E disk. If it is the E disk, it is correct. 12. Stop the
service
10 3. Put the Data folder containing the original data copied in the second step under the modified path in my.ini
(copy the past Data folder and delete it after the new installation)
14. Start the service and verify the connection
15. You can view the original database and data, get it done