mysql_upgrade
mysql_upgrade
is a tool that checks and updates your tables to the latest version.
Usage:
mysql_upgrade [--force] [--user=# --password --host=hostname --port=# --socket=# --protocol=tcp|socket|pipe|memory --verbose] OTHER_OPTIONS]
You should run mysql_upgrade
when you upgrade from another
major MySQL/MariaDB release, like from MySQL 5.0 to MariaDB 5.1.
The following groups are read from the my.cnf files: [mysql_upgrade] and [client].
The following options to handle option files may be given as the first argument:
--print-defaults | Print the program argument list and exit. |
--no-defaults | Don't read default options from any option file. |
--defaults-file=# | Only read default options from the given file #. |
--defaults-extra-file=# | Read this file after the global files are read. |
Main arguments are:
-?, --help | Display this help message and exit. |
-#, --debug[=name] | Output debug log. |
--debug-check | Check memory and open file usage at exit. |
-T, --debug-info | Print some debug info at exit. |
-f, --force | Force execution of mysqlcheck even if mysql_upgrade has already been executed for the current version of MySQL. |
-h, --host=name | Connect to host. |
-p, --password[=name] | Password to use when connecting to server. If password is not given, it's solicited on the tty. |
-P, --port=name | Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306). |
--protocol=name | The protocol to use for connection (tcp, socket, pipe, memory). |
-s, --silent | Print less information. |
-S, --socket=name | The socket file to use for connection. |
-t, --tmpdir=name | Directory for temporary files. |
-u, --user=name | User for login if not current user. |
-v, --verbose | Display more output about the process. |
--write-binlog | All commands including mysqlcheck are binlogged. Enabled by default ; Use --skip-write-binlog when commands should not be sent to replication slaves. |
"mysql_upgrade" is mainly a framework to call mysqlcheck. mysql_upgrade works by doing the following operations:
# Find out path to datadir echo "show show variables like 'datadir'" | mysql mysqlcheck --no-defaults --all-databases --fix-db-names --fix-table-names --write-binlog mysqlcheck --check-upgrade --all-databases --auto-repair --write-binlog mysql_fix_privilege_tables
The connect options given to mysql_upgrade are passed along to mysqlcheck and mysql.
The mysql_fix_privilege_tables script is not actually called; it's included as part of mysql_upgrade.
If you have a problem with mysql_upgrade, try run it in very verbose mode:
mysql_upgrade --verbose --verbose other-options
The following differences exists between "mysql_upgrade" in MariaDB and MySQL (as of MariaDB 5.1.50):
- MariaDB will convert long table names properly.
- MariaDB will convert InnoDB tables (no need to do a dump/restore or ALTER TABLE).
- MariaDB will convert old archive tables to the new 5.1 format (note: new feature in testing).
- "mysql_upgrade --verbose" will run "mysqlcheck --verbose" so that you get more information of what is happening.
- More descriptive output.