MySQL Import and Export Database
MySQL data structure The basic import/export commands for SQL linux windows databases are mysqldump and Source
In Linux, you can directly use the command line operation. In Windows, there are two methods. One is to use the command line, and the other is to use phpMyAdmin.
The phpMyAdmin tool is easy to export and import. During the import, you do not need to create a database and restore it to the original database. You can use the source tool to restore it. However, the size limit of the imported files cannot exceed 2 MB.
Let's talk about how fast mysqldump and source commands are to be used. But to import the exported files, you must first create a database (This database can be named casually) this step is also required for importing files exported from mysqldump using phpMyAdmin after entering the database.
The following describes how to use the copy command from the predecessors.
1. Export the entire database
Mysqldump-u username-P Database Name> exported file name
Mysqldump-u wcnc-P smgp_rj_wcnc> wcnc. SQL
2. Export a table
Mysqldump-u user name-P database name Table Name> exported file name
Mysqldump-u wcnc-P smgp_rj_wcnc users> wcnc_users. SQL
3. Export a database structure
Mysqldump-u wcnc-p-d -- add-drop-Table smgp_apps_wcnc> D: wcnc_db. SQL
-D no data -- add-drop-table adds a drop table before each create statement.
Memo: mysqldump can be directly used in Linux. Sometimes it needs to be used in MySQL/bin in windows, because sometimes commands like appserv can not be used directly because these commands are not in the backup files in the environment variable directory and exported using mysqldump must be created before the database can be imported.
4. Import the database
Common source commands
Go to the MySQL Database Console,
For example, MySQL-u root-P
Mysql> Use Database
Then run the source command. The following parameter is the script file (for example,. SQL used here)
Mysql> source D: wcnc_db. SQL
Suspect: phpMyAdmin has a limited import size. I don't know if there is a limit on the number of source files to be imported, and cannot limit the file size and score files to be exported during export.
Article Source: feino Network (www.firnow.com): http://dev.firnow.com/course/7_databases/mysql/myxl/2008920/144108.html