Database Reference
In-Depth Information
Full documentation of the mysqlhotcopy program is found at https://mariadb.
com/kb/en/mysqlhotcopy/ .
Making cold backups
Another option for backing up MariaDB is to just copy the entire data directory. This
is called a cold backup . As mentioned at the beginning of this section, problems can
arise if we try to do this while MariaDB is running, but if we stop MariaDB briefly,
and are using a filesystem that supports snapshots (called shadow volume copies on
Windows) we can stop MariaDB briefly, make a snapshot, and then start MariaDB.
Total downtime for an operation such as this, depending on various factors, might be
only a few seconds. The snapshotted directory may then be backed up like any other
filesystem directory backup.
This is obviously not an ideal way to make backups in all situations, especially when
stopping the database server, even for a few seconds, is not an option. But it can
work very well in some cases.
Checking and repairing tables
After a hardware failure, after a power outage, or even after an upgrade, it is a good
idea to check the tables in our MariaDB databases to make sure they are ok. MariaDB
includes several utilities to do this.
Checking and optimizing tables with
mysqlcheck
The mysqlcheck program can check, analyze, optimize, and repair MariaDB
database tables. Basic syntax for the command is as follows:
mysqlcheck [options] [-u username] [-p] database_name [table_name]
Here is an example of running the command to check our test database, and its output:
daniel@gandalf:~$ mysqlcheck -u root -p test
Enter password:
test.employees OK
We can specify multiple databases using the --databases option as follows:
mysqlcheck -u root -p --databases db_name1 db_name2 db_name3
 
Search WWH ::




Custom Search