Mysql data Location Modification

Source: Internet
Author: User

1. log on to the mysql monitor command: cmd>Mysql-u root-pThen press enter to enter the password


2. the mysql configuration file is my. ini under the installation directory.

The slave database crashes directly, and the root user cannot log in. Resetting instance config directly causes an infinite number of failures at the start service... Finally, I tried to select remove existed instance in the first step of instance config, and then reset it again. At the end of the start, I was patient and finally recovered to normal .. OMG ~


3. Check the storage location of the database on the disk: mysql>Show variables like '% datadir % ';


Go to the directory under drive C to view (hidden folder). The data exists here, and each database corresponds to a folder,

My goal is to change this address to the data folder under the mysql installation directory of the E disk. I have read these two articles (Be sure to be careful, otherwise it will be easy to make mistakes ):

Http://blog.163.com/jerry78mu@126/blog/static/1310814462010113022546193/

Http://blog.csdn.net/dengqiaodey/article/details/7878886

The procedure is as follows:

  • Copy all the folders in C: \ ''''' ''' \ data to the target location E: \ ''' \ data (do not delete the data files on drive C to avoid errors in future configuration );


  • Open the my. ini file in the installation directory and find this line:Datadir = "C:/ProgramData/MySQL
    Server 5.5/data /"

To:Datadir = "E: \ MySQL \ data", Pay special attention to "\" rather than "/", otherwise it cannot be successful (somehow !!!)

  • Return all calls to mysql.exe. The task manager checks whether the MySQL service has stopped,

If not, run the following command in cmd:Net stop mysqlStop the service. ThenNet start mysqlRestart the service

  • The database location is queried again.



1. log on to the mysql monitor command: cmd>Mysql-u root-pThen press enter to enter the password


2. the mysql configuration file is my. ini under the installation directory.

The slave database crashes directly, and the root user cannot log in. Resetting instance config directly causes an infinite number of failures at the start service... Finally, I tried to select remove existed instance in the first step of instance config, and then reset it again. At the end of the start, I was patient and finally recovered to normal .. OMG ~


3. Check the storage location of the database on the disk: mysql>Show variables like '% datadir % ';


Go to the directory under drive C to view (hidden folder). The data exists here, and each database corresponds to a folder,

My goal is to change this address to the data folder under the mysql installation directory of the E disk. I have read these two articles (Be sure to be careful, otherwise it will be easy to make mistakes ):

Http://blog.163.com/jerry78mu@126/blog/static/1310814462010113022546193/

Http://blog.csdn.net/dengqiaodey/article/details/7878886

The procedure is as follows:

  • Copy all the folders in C: \ ''''' ''' \ data to the target location E: \ ''' \ data (do not delete the data files on drive C to avoid errors in future configuration );


  • Open the my. ini file in the installation directory and find this line:Datadir = "C:/ProgramData/MySQL
    Server 5.5/data /"

To:Datadir = "E: \ MySQL \ data", Pay special attention to "\" rather than "/", otherwise it cannot be successful (somehow !!!)

  • Return all calls to mysql.exe. The task manager checks whether the MySQL service has stopped,

If not, run the following command in cmd:Net stop mysqlStop the service. ThenNet start mysqlRestart the service

  • The database location is queried again.



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.