Ubuntu 20.04
Sponsored Link

MySQL 8.0 : Backup with mysqldump
For Backup and Restore MySQL Data, it's possible to run with [mysqldump].
[1] Run [mysqldump] to take dump data of MySQL.
# lock all tables and dump all data in MySQL

# during dumping data, reading is also locked, so acutually impossible to use Databases

mysqldump --lock-all-tables --all-databases --events > mysql_dump.sql

# dump all data without locking but with transaction

# ensured data integrity by [--single-transaction] option

mysqldump --single-transaction --all-databases --events > mysql_dump.sql

# dump specific database

mysqldump test_database --single-transaction --events > mysql_dump.sql

[2] For restoring data from backup on another host, run like follows.
Before restoring, transfer dump data to the target host with [rsync] or [scp] and so on.
# for all dumped data, simply import a file

mysql < mysql_dump.sql

# for dumped data with specific database,

# create a empty database first with the same DB name and next, import a file

mysql test_database < mysql_dump.sql

Matched Content