Home > Database > Mysql Tutorial > body text

Detailed explanation of how to modify the data location of Mysql5.7 under Windows 7

小云云
Release: 2018-02-11 10:47:51
Original
1671 people have browsed it

Update: Now go to the MySQL official website and install the mysql installer to uniformly manage and configure the mysql software. Migrating data is also very convenient. Enter the mysql installer to reconfigure the mysql server, and the database storage location will be changed. It is more stable than the old-fashioned manual migration below (it is easy for the database to fail to start or close properly after manual migration). This article mainly introduces to you the method of modifying the loading path and data location of the my.ini file of Mysql5.7 under Windows 7. Friends in need can refer to it. I hope it can help you.

Because I want to transfer the company's online database to the local for testing, I have been tinkering for a long time to modify the data location of the local mysql. There are also many introductions to the online information. I will not go into details. I will write down the problems I encountered for reference. For everyone’s reference.

mysql version: 5.7
os: windows7

(Different mysql versions may have differences in the installation path data path and my.ini startup configuration file path Differences, no research required)

Change the data location of mysql, except what the information on the Internet says:

(1) Close the mysql service;

(2) Modify the datadir of my.ini (path "\" or "/", whether the entire path name requires double quotes, please try it yourself, whatever works, I don't need double quotes, forward and back slashes are fine);

(3) Then migrate the entire data folder (this data folder may be in different folders depending on the version and system, for example, it may be in c:\Program Files\MySQL or c:\ProgramData\ Under MySQL, it is recommended to use the software everything to find it yourself) to the modified directory; (4) Finally restart.

In addition to these 4 basic steps, you must also pay attention to which startup file my.ini is used by MySQL. This is subject to the information of mysql in the windows registry. The specific operation is: Start-Run-regedit-Enter, enter the windows registry, and then find [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySql] (Note that this is the registration path under win7 and mysql5.7, other versions may be different), just modify the path file after "--defaults-file=" in "ImagePath". This file is when mysql starts. The configuration file read is not necessarily placed in the mysql installation directory or the data directory, it must be the configuration file used.

Related recommendations:

Detailed example of how to create the my.ini file in the MySQL5.7.19 installation directory

MySQL 5.6 & 5.7 optimal configuration file template (my.ini)_MySQL

MySQL optimization configuration file my.ini (discuz forum)

The above is the detailed content of Detailed explanation of how to modify the data location of Mysql5.7 under Windows 7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!