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: