Database Reference
In-Depth Information
will executed conditionally based on the version of MySQL or MariaDB that is installed
on the server. That's why the lines start with /*! and not just /* . Within the dump file,
comment lines are prefaced instead with -- .
You can reduce the size of the dump file by including one or more of the following op-
tions when running mysqldump :
--skip-add-drop-table
Leave out DROP TABLE statementsthat clean up old tables.
--skip-add-locks
Dump without firstlocking each table.
--skip-comments
Suppress commentsin the file.
--skip-disable-keys
Suppress commandsthat manipulate the indexes in the tables.
--skip-set-charset
Suppress SET NAMES statementsthat control the character set in use.
--compact
Use all of the previousoptions in this list.
Some of the options in the preceding list have potentially risky consequences. For in-
stance, if you don't set the character set, you may end up with the wrong one, and if you
don't lock the tables while the server is running, it could make changes while you're
dumping and end up with an inconsistent table in the backup.
Because a dump file may be used to copy databases from one server to another, and not
just for backup and recovery on the same server, the conditional statements are used to
check that the server for which the SQL statements in the dump file will be executed. This
is necessary so that there won't be any problems when starting to execute the SQL state-
ments that create tables and insert data. When the dump file is executed, it will restore or
re-create the databases and tables exactly as they were at the time of the dump.
Let's look back at the first SET command:
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */ ;
Search WWH ::




Custom Search