MYSQL import and export, mysql Import and Export Database
Export all data in the entire database
1. Enter the following in the linux Command Line:
?
1 |
mysqldump -u userName -p dabaseName > fileName.sql |
FileName. It is best to add the path name to SQL.
Export the data of a table in the database
?
1 |
mysqldump -u userName -p dabaseName tableName > fileName.sql |
Export all table structures in the entire database
In the linux Command Line, enter:
?
1 |
mysqldump -u userName -p -d dabaseName > fileName.sql |
Note:-d is added.
Export the table structure of a table in the entire database
In the linux Command Line, enter:
?
1 |
mysqldump -u userName -p -d dabaseName tableName > fileName.sql |
Note:-d is added.
Import mysql method 1
Go to the linux Command Line:
?
123 |
Mysql-uroot-p press enter to enter the password source fileName.sql Note that fileName. SQL must have a path name, for example, source/home/ user /data/fileName.sql |
Method 2 for importing mysql
Go to the linux Command Line:
?
12 |
mysql -uroot -p database < fileName.sql Note that fileName. SQL must have a path name. |
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.