How to import data into a new database without exporting SQL scripts when MySQL transfers the database

Source: Internet
Author: User

For some reason, when transferring data from a database, no SQL scripts are exported, and then the pits are not required. However, after a busy afternoon, finally found a way to import the database folder directly into the new MySQL file folder under the data file, you can directly use.

Concrete steps, look down

To stop the MySQL service (net stop MySQL) before the operation, start the MySQL service (net start MySQL) after all operations are completed

(1) Locate the Data folder in the MySQL installation file

(2) Copy the folder in a database under your original data to the data folder in the new MySQL installation file, where the folder name is the name of your database. So it's also possible for you to create a new database. Note also in the data directory to add your original database ibdata1 this file , or you can only look at the name and structure of the table, can not be used.

Note: There is a special pit in this process, even though you can find the Data folder in the MySQL installation file, but when you put the old database folder in, and then use CMD to find the name of the newly placed database, you will find that there is no. That is because although there is a data folder, but this data folder does not work at all, at this time, you can operate, the hidden folder under Windows Display, and then find the Mysql/data, at this time, then put the folder under Data, you can. Can look at the following figure

How to import data into a new database without exporting SQL scripts when MySQL transfers the database

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.