It is useful to be able to do database backups and restoration at the command line. Here's my commands for doing so, no 3rd party tools needed for this, just mysql. You can restore the database to a different server entirely.
mysqldump -h 127.0.0.1 -P [my_port] -u [me] -p[password] -B my_database >the_bak
where:
[password] is the database password (no space).
[me] is the mysql admin account username
my_database is the name of your database.
[my_port] database access port, default =3306
Restoration:
create database:
mysql -u[me] -p[password] information_schema -e "create database my_database"
restore database:
mysql -u[me] -p[password] my_database < ./the_bak.sql
No comments:
Post a Comment