Dumping a
database is useful for backing-up and restoring tasks.
The
prompt commands are almost identical in both cases:
First
change directory to the MySQL executable:
> cd "C:\Program Files\MySQL\MySQL Server
5.7\bin"
To
dump a database:
>
mysqldump -u root -p mydb > C:/path/mybackupfile.sql
To
restore a database:
>
mysql -u root -p mydb < C:/path/mybackupfile.sql
It
is interesting to open with a text editor the file .sql created to see the
structure and the data.
Notes:
- The same procedure can be done to restore values from a .dump file, which typically is:
(10001,62102,'1987-06-26','1988-06-25'),
....
- To delete a database: drop database mydb
No comments:
Post a Comment