How to modify Mysql's Data folder storage location under Windows _mysql

Source: Internet
Author: User

Following the normal steps to install MySQL, the default directory for DataDir found is

Copy Code code as follows:
C:\Documents and Settings\All Users\Application Data\mysql\mysql Server 5.1\data

Originally C disk capacity is not much, of course, can not be placed in this ~ ~ so follow the online steps, in the My.ini file has been modified, and then in the "service" inside the restart service, the terrible thing happened, there is a "local computer can not start the MySQL service" error, the sorrow died, had to unload and reload, The problem is the same, non-stop Baidu Google, finally resolved, summed up as follows.
First, login to the MySQL monitor command:
Copy Code code as follows:

CMD >> mysql-u root-p//Then enter the password

Ii. to see where the database is stored on disk:
Copy Code code as follows:
MySQL > Show variables like '%datadir% ';


Go to C disk under this directory to view (hidden folder), sure enough data is there, each database corresponding to a folder, my goal is to change this address to E disk MySQL installation directory of the Data folder, must step carefully, otherwise it is easy to make mistakes.
Third, modify the data storage location
1. Copy all folders under C:\ ' ' \data to the target location e:\ ' \data (do not delete the data files under C disk, so that the error will not be configured later);

2. Open the installation directory of the My.ini file, find this line: datadir= "C:/programdata/mysql/mysql Server 5.5/data/" modified to: Datadir= "E:\MySQL\data", special attention is "\ "Rather than"/", or not succeed (somehow!!! )
3. Quit all calls to Mysql.exe, Task Manager look at the service MySQL has not stopped, if not, in cmd command net stop MySQL service. Then restart the service in net start MySQL

4. Query the database location to see if it was successful


Four, the MySQL crash solution
In order to modify the data storage location (default in C disk), I privately modified the my.ini inside a word, the result of direct MySQL service can not start, even Mysqld.exe also directly crashes, root users also login not to go in, reset instance Config directly in the start service one step infinite card die ... Finally try the first step in instance config to choose Remove existed instance, and then reset it again, in the last start of patience, finally back to normal. omg~

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.