Mysql database how to import export (backup restore) _mysql

Source: Internet
Author: User
Tags mysql command line

The scope of this article: a comprehensive description of MySQL database operations, divided into virtual host and server two situations.

Virtual Host

1, through the phpMyAdmin import and export function, this software generally only supports the export of several megabytes of data, too large data may time out.

2, through the program with the database backup restore function to operate, some common PHP programs such as DZ Forum, the background has database restore and backup functions, convenient for us to transfer space data.

3. If your database is purchased in Chao data, our admin panel supports one-click Backup and Restore. Click on the Backup button, you can go to the database corresponding to the space through the FTP way to download.

Server or VPS

First we remotely to the server (Windows or Linux can), and ready the root password or specific database username password.

One, database import (Restore)

1. SOURCE command

1 Open the Start menu-> program->mysql->mysql Command line Client, enter the MySQL root password.

2 then enter use 数据库名; the corresponding database, and then use the source 备份文件具体路径; command to import the backup file. Note that the following commands are appended to the command, with a semicolon and a screenshot as follows:

2, MySQL command

1 if it is a Windows system, please enter MySQL's bin directory in command line mode, such as D:\Program\mysql41\bin. If it is a Linux system, please look at the following steps directly.

2 execute MySQL command to import the database, the command format is:

Mysql-u User name-p password database name < backup file specific path

For example: The mysql -uroot -pabc123 mydb<file.sql user name and password can also be specific database, not necessarily root. Screenshot below:

II. database Export (Backup)

General use of the mysqldump command

1 if it is a Windows system, please enter MySQL's bin directory in command line mode, such as D:\Program\mysql41\bin. If it is a Linux system, please look at the following steps directly.

2 Execute mysqldump command to import the database, the command format is:

Mysqldump-u User name-p password database name > backup file specific path

For example: The mysqldump -uroot -pabc123 mydb>file.sql user name and password can also be specific database, not necessarily root. If the using LOCK tables error occurs, please add--skip-lock-tables behind the database and no error will be made. Screenshot below:

Related Article

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.