create database backup using mysqldump
Creates
backup.sql
backup file of
some_db
database using
some_user
MySQL user. The database is located at
34.mysql.servage.net
server.
mysqldump -h 34.mysql.servage.net -u some_user -p some_db > backup.sql
Creates
backup.sql
backup file of
some_db
database with the same MySQL user but without
-h
flag. If the database is located on the same server (localhost)
-h
flag is not necessary to specify
mysqldump -u some_user -p some_db > backup.sql
If we want to include all the routines (procedures, functions), then we need to use flag
-R
mysqldump -u some_user -p some_db -R > backup.sql
If we want to export only one or several tables, then we should list tables after database name
mysqldump -u root -p sdtokens sdt_prices another_table > sdt_prices.sql
After running the command, we will be required to enter password of the
some_user
mysql user. After that, MySQL will create
backup.sql
file on the same location
by Valeri Tandilashvili
4 years ago
Linux
MySQL
Command line
0
Pro tip: use ```triple backticks around text``` to write in code fences