mysql backup restore mysqldump.exe several common use cases
- 2020-05-07 20:33:20
- OfStack
Export the entire database
mysqldump -u user name -p database name > exported file name
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2. Export 1 table
mysqldump -u user name -p database name table name > File name exported by
mysqldump -u wcnc -p smgp_apps_wcnc users > wcnc_users.sql
Export a database structure
mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc > d:\wcnc_db.sql
-- add-drop-table adds 1 drop table before each create statement
4. Import the database
The source command is commonly used
Go to the mysql database console,
Such as mysql -u root -
mysql > use database
Then use the source command, followed by a script file (like.sql here)
mysql > source d:\wcnc_db.sqlBR >
mysqldump -u user name -p database name > exported file name
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2. Export 1 table
mysqldump -u user name -p database name table name > File name exported by
mysqldump -u wcnc -p smgp_apps_wcnc users > wcnc_users.sql
Export a database structure
mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc > d:\wcnc_db.sql
-- add-drop-table adds 1 drop table before each create statement
4. Import the database
The source command is commonly used
Go to the mysql database console,
Such as mysql -u root -
mysql > use database
Then use the source command, followed by a script file (like.sql here)
mysql > source d:\wcnc_db.sqlBR >