MySQL database backup and recovery methods, mysql Database Backup
MySQL database backup and recovery methods
Mysql-uroot-p
Show databases;
1. Export the database
1). MySQL command line to export the entire database (including data)
The exported files are stored in the mysql \ bin directory by default.
Mysqldump-u username-p Database Name> exported file name
Mysqldump-uroot-p123456 database_name> outfile_name. SQL
2). Export a table from the MySQL Command Line
Mysqldump-u user name-p database name Table Name> exported file name
Mysqldump-u user_name-p database_name table_name> outfile_name. SQL
3). Export a database structure from the MySQL Command Line
Mysqldump-u user_name-p-d-add-drop-table database_name> outfile_name. SQL
-D no data-add-drop-table add a drop table before each create statement
4). Export with language Parameters
Mysqldump-uroot-p-default-character-set = latin1-set-charset = gbk-skip-opt database_name> outfile_name. SQL
5) Back up multiple MySQL databases at the same time
Mysqldump-hhostname-uusername-ppassword-databases databasename1 databasename2 databasename3> multibackupfile. SQL
2. Import Database
1) run the mysqldump command:
Mysqldump-u user_name-p <outfile_name. SQL
2) use the source command
Mysql-uroot-p
Use databasename;
Source outfile_name. SQL
-------------------------------------
Dylan Presents.