How to change the storage location of a Mysql database

Source: Internet
Author: User

1. Stop mysql services first.

2. Change the master path of database storage in MySQL configuration file My. ini

Open the default MySQL installation folder C: \ Program Files \ MySQL Server 5.1 In my. INI file, click "edit" and "Search" at the top of the notepad ", enter datadir in the search content and click "find next" to go to "Path to the database root database storage master Path" parameter settings, find datadir = "C: /Documents and Settings/All Users/Application Data/MySQL Server 5.1/Data/"is the default database storage master path setting, which is now changed to C: \ mysql \ data (what you want) folder. The correct setting is datadir = "C:/mysql/data /".

After the changes are completed, click "file" in the menu bar and then click "save ".

3. Copy the database files and folders in the master path of the old database storage to the new master path.

Copy All the files and folders in the C:/Documents and Settings/All Users/Application Data/MySQL Server 5.1/Data/folder to the folder you created.

4. Restart the MySQL Service

5. Verify that the operation to change the primary path of the database is successful

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.