Copy MySql database file backup database in linux

Source: Internet
Author: User
Generally, MySql database backup can be performed in two ways: Exporting SQL statements directly or SQL storage files in other formats that are easy to import, and using SQL statements or some visual clients to export data. This method is very simple.

Generally, MySql database backup can be performed in two ways: Exporting SQL statements directly or SQL storage files in other formats that are easy to import, and using SQL statements or some visual clients to export data. This method is very simple.

Generally, MySql database backup can be performed in two ways: Export SQL statements directly or export SQL storage files in other formats that are easy to import. The Hong Kong server is rented, you can use SQL statements or some visual clients to export data. This method is very simple and does not need to be described in detail. Another method is to copy the database file and convert the database file into an SQL file, Vm, this article introduces this method for Hong Kong virtual hosts.

① Find the location where the database files are stored. The suffixes of MySql files include *. MYD, *. MYI, and *. frm;

  • ② Enter the database storage file directory;

  • Cd/opt/lan mp/mysql-5.1.63/win/data/
  • ③ Use the copy command to copy all the data;

  • Copy mysql/home
  • ④ At this time, you only need to convert these database files into SQL files, which is also the focus of this Article. If you need to import the SQL files with commands, you can;

    ⑤ Create a new database named mysqlbak and paste the copied folder into the data folder of the new database;

  • Cd/home/mysql
  • Copy */www/wdlinux/mysql-5.1.63/var/mysqlbak/
  • ⑥ Now we can see the data in the new database mysqlbak, which is the same as the data in the original database mysql;

    7. Use commands to export database files.

  • Mysqldump-uroot-p mysqlbak>/home/mysql. SQL
  • The mysql. SQL file in the home folder is a database file that is easy to import. Note that all operations must be completed using commands in the operating system, rather than using tools. In actual operation, we often encounter the inconsistency between the database file version and the database version, or the inconsistency between the new and old database versions, in addition, unexpected problems such as incompatibility between the data server version and client tools may occur. If this is the case, "1577: cannot proceed because system tables used by Event sched1_were found damaged at server start "error. Speaking of this, in fact, this article also provides a method to open mysql database files, if there are only a bunch *. MYD ,*. MYI ,*. in the frm file, perform Step 5 to Step 5.

    This article is from the "Rainbow cat walking across the world" blog!

    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.