Restoring Dump Files To Directory
To restore SQL dumps to a directory, you set the where
parameter to
a valid directory.
* restore where=/tmp
Although the database name below is mydb
, the following .sql
files should be restored in the /tmp
:
# ls -lR /opt/bacula/archive/bacula-restores/
/opt/bacula/archive/bacula-restores/:
total 4
drwxr-xr-x 3 root root 4096 Nov 18 10:20 @MYSQL
/opt/bacula/archive/bacula-restores/@MYSQL:
total 4
drwxr-xr-x 3 root root 4096 Nov 18 10:20 main
/opt/bacula/archive/bacula-restores/@MYSQL/main:
total 4
drwxrwsr-x 2 root 1001 4096 Nov 18 10:23 mydb
/opt/bacula/archive/bacula-restores/@MYSQL/main/mydb:
total 12
-rw-r----- 1 root root 0 Nov 15 16:04 createdb.sql
-rw-r----- 1 root root 2675 Nov 18 10:22 data.sql
-rw-r----- 1 root root 18 Nov 15 16:04 grants.sql
-rw-r----- 1 root root 2072 Nov 18 10:23 schema.sql
The database(s) can be restored using the mysql
commands:
mysql --host <mysql_server_ip_or_FQDN> -uroot -p"<password>" --execute "CREATE DATABASE mydb"
mysql --host <mysql_server_ip_or_FQDN> -uroot -p"<password>" --database mydb < schema.sql
mysql --host <mysql_server_ip_or_FQDN> -uroot -p"<password>" --database mydb < data.sql
mysql --host <mysql_server_ip_or_FQDN> -uroot -p"<password>" --database mydb < grants.sql
Refer to the MySQL documentation for more details about the MySQL Command-Line Client options: https://dev.mysql.com/doc/.
See also
Go back to:
Go to:
Go back to the Restoring Using Dumps page.
Go back to the Restore page.
Go back to the main Operations page.