In the command line, mysql DATA export has a very useful command mysqldump. Its parameters include the handler, which can be viewed as follows:
Mysqldump
Most commonly used:
Mysqldump-uroot-pmysql databasefoo table1 table2> foo. SQL
In this way, table1 and table2 of database databasefoo can be imported into foo in SQL format. in SQL, the-uroot parameter indicates that the user name used to access the database is root. If there is a password, the-p parameter must be added.
Eg:
C: \ Users \ jack> mysqldump-uroot-pmysql sva_rec date_drv> e: \ date_drv. SQL
Mysql DATA import is also quite convenient, such:
Mysql-uroot databasefoo <foo. SQL
In this way, all data of foo. SQL can be imported into database databasefoo.
1. Export the entire database
Mysqldump-u username-p Password Database Name> exported file name
C: \ Users \ jack> mysqldump-uroot-pmysql sva_rec> e: \ sva_rec. SQL
2. Export a table, including the table structure and data
Mysqldump-u user name-p Password Database Name Table Name> exported file name
C: \ Users \ jack> mysqldump-uroot-pmysql sva_rec date_rec_drv> e: \ date_rec_drv. SQL
3. Export a database structure
C: \ Users \ jack> mysqldump-uroot-pmysql-d sva_rec> e: \ sva_rec. SQL
4. Export a table with only the table structure
Mysqldump-u username-p password-d database name Table Name> exported file name
C: \ Users \ jack> mysqldump-uroot-pmysql-d sva_rec date_rec_drv> e: \ date_rec_drv. SQL
5. 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
Sometimes, you can write an import program and a java Script to import data to mysql.