Export all data in the entire database
1. Enter on the linux command line:
1
|
mysqldump -u userName -p dabaseName > fileName.sql
|
fileName.sql is best to add the path name
Export data from a table in the database
1
|
mysqldump -u userName -p dabaseName tableName > fileName.sql
|
Export all table structures in the entire database
Enter on the linux command line:
1
|
mysqldump -u userName -p -d dabaseName > fileName.sql
|
Note: -d is added
Export the table structure of a table in the entire database
Enter on the linux command line:
1
|
mysqldump -u userName -p -d dabaseName tableName > fileName.sql
|
Note: -d is added
import mysql method 1
Enter the linux command line:
1
2
3
|
mysql -uroot -p 回车 输入密码
source fileName.sql
注意fileName.sql要有路径名,例如:source /home/
user
/data/fileName.sql
|
import mysql method 2
Enter the linux command line:
1
2
|
mysql -uroot -p
database
< fileName.sql
注意fileName.sql要有路径名
|