Restoring Using MySQL Command-Line Tool
It is possible to use the MySQL Command-Line Tool to restore from the dump files generated by backup jobs using the MySQL plugin in Dump mode.
The MySQL plugin generate, in a Dump mode backup, the files related in Table Dump Mode Options.
The MySQL plugin will generate the following files entries in the Bacula catalog for a server having a single database “test”:
/etc/mysql/my.cnf
@MYSQL/main/gobal-grants.sql
@MYSQL/main/settings.txt
@MYSQL/main/test/createdb.sql
@MYSQL/main/test/schema.sql
@MYSQL/main/test/data.sql
@MYSQL/main/test/grants.sql
To restore the single database “test”, please follow the below sequence of commands.
At this time, the createdb.sql file is a dummy file used to create the database if selected in the restore process. We might enhance the plugin to add the SQL command used to create a database. So please manually create the database:
# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
...
mysql> create database test;
Query OK, 1 row affected (0.00 sec)
mysql> quit
Bye
Then restore schema, data and privileges:
# mysql -u root --database=test < /path/to/\@MYSQL/main/test/schema.sql
# mysql -u root --database=test < /path/to/\@MYSQL/main/test/data.sql
# mysql -u root --database=test < /path/to/\@MYSQL/main/test/grants.sql
When restoring the MySQL server or the “mysql” database, it may be needed to restore global privileges:
# mysql -u root < /path/to/\@MYSQL/main/global-grants.sql
The “settings.txt” file contains the current variables for the MySQL server. This file is not used automatically by the restore process. Its content can be used to restore the current MySQL server settings or to re-configure a MySQL server on a new system, for example.
See also
Go back to:
Go back to the Restoring Using Dumps page.
Go back to the Restore page.
Go back to the main Operations page.