Use commands to export the table structure and data bitsCN.com from mysql
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.
BitsCN.com