Second level exam MySQL database How to use? MySQL Copy database library file, copy and restore the display table does not exist how to do

Source: Internet
Author: User

Problem environment, recently prepared MySQL exam, with the * * Education question Bank, do the operation of the problem when the database file to copy the data directory, can display the table, but cannot manipulate the table

1 View the directory where MySQL holds the database files

2 Copy the database file to the data directory, remember to copy the file should exit the MySQL console, the MySQL service shut down, copy, and then open the MySQL service,

Ps can manage –> services and applications on my computer, find MySQL service, also can be quickly turned off and on in CMD console, click on search input cmd in lower left corner of Windows, then right click to select Open With administrator

Then input, note the box is the service name, there may be you give me different, because the version of MySQL may not be the same

3 after copying found that there is a table but can not manipulate the table, the display table does not exist, obviously there is a table on it

4 but we went to the data directory and found a few more files in the data directory.

5 error prompt file. Err, preceded by hostname, different host file name, but suffix is the same, view hostname, Ipconfig/all

6 We open with Notepad, the error log file ending with err, the prompt error, actually also gives you the solution, hints that the InnoDB engine is missing

Part

7 View the engine of the current database

8 found that the default database engine is InnoDB, when you create a table if you do not specify the engine of the database, then his default engine is InnoDB, and the error inside prompted InnoDB missing is what, Baidu said, InnoDB and ibdata1 files about, Again Baidu a bit ibdata1 is what http://blog.csdn.net/anljf/article/details/6653282

9 Head, copy of the database file, which is only the database and the structure of the table, shown when the show is still visible, but the select is a problem, because the data stored in another file, is ibdata1, so when you back up the database can not only copy database files, Also need to copy ibdata1 this file, and when you restore the database, you have to copy the two files in the data directory, when prompted to choose to replace the original ibdata1 file

Ps very important point, as IT staff most important is backup, backup, and then back up, but today is still lost hoof, practice writing a small web page, with MySQL, is also relatively busy recently, so do not go to the virtual machine library to do, on the physical machine above, when I click Replace, Instantly woke up, a little GG think smecta feeling, although not know where the wrong, but a kind of ominous premonition, go back to cmd console, select a look, I originally created table all can not operate, want to cry no tears, because we replace the ibdata1, file is someone else created table, Save the data of other people's tables, and do not save our own data, so anyway, when to replace the time, should not be the file back up?

11 know how to solve the put, is to copy the ibdatadb1 file to the data directory replacement, remember to backup YO!!! But the weird thing is, after copying the past, it still doesn't show.

12 of course because of these three files, these three files are generated when starting the MySQL service and log in to MySQL, recorded some important configuration and information, so ah have to delete three files, deleted before the MySQL service should be shut down, can be in my computer--management –> Services and applications to find MySQL services

13 and then reboot, then operate the database.

The road to learning is long!

Second level exam MySQL database How to use? MySQL Copy database library file, copy and restore the display table does not exist how to do

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.