When upgrading the database using the synchronization tool and Common commands between data of different mysql versions, you usually need to synchronize the data in the old version to the new version of mysql service. For the MyISAM format, you can copy the data file directly, and then modify the File Permission (chown-R mysql: mysql data) to solve the problem. However, for the innodb format, this method does not work. So I wrote a tool to facilitate data backup. The procedure is as follows: 1. Start the new mysql service #: bin/mysqld_safe -- port = 3308 -- socket =/tmp/mysql2.sock & 2. Synchronize mysql Service Permissions [Optional] Java code // synchronize permission data #: mysqldump -- opt mysql | mysql-P 3308 -- socket =/tmp/mysql2.sock mysql // during each upgrade, we should execute the mysql_upgrade command, it uses the // mysqlcheck command to check whether the database is compatible with the new version and fix it at the same time. // another important function is to use the mysql_fix_privilege_tables command to upgrade the permission table. #: Mysql_upgrade-P 3308 -- socket =/tmp/mysql2.sock 2. Java code for synchronizing Application Data TO_MYSQL_SOCK =/tmp/mysql2.sock TO_MYSQL_PORT = 3308 dataList = 'mysql-s-e "show databases "' for databaseName in $ {dataList [*]} do # filter out tables that do not need to be synchronized. case $ databaseName in Database | mysql | test | performance_schema | information_schema) echo "ignore Database:" $ databaseName; *) echo: "$ databaseName mysqladmin-P $ {TO_MYSQL_PORT} -- socket =$ {TO_MYSQL_SOCK} create $ {databaseName} mysqldump -- opt $ {databaseName} | mysql-P $ {TO_MYSQL_PORT} -- socket = $ {TO_MYSQL_SOCK }$ {databaseName };; esac done 3. Disable the old database service and enable common commands of the new database service: grant all privileges on *. * TO 'root' @ '192. 168.0.% 'identified BY '1' with grant option; feature set: show variables like 'character _ set _ % '; clear binary logs: mysql> flush logs; mysql> reset master; delete useless passwords delete from user where password = ""; flush privileges; initial password :. /bin/mysqladmin-u root password 'new-password '. /bin/mysqladmin-u root-h server-171 password 'new-password' 5.6.10 (default character utf8) cmake-DCMAKE_INSTALL_PREFIX =/opt/app/mysql-5.6.10 \-character =/opt/app/mysql-5.6.10/data \-DDEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = utf8_general_ci \-DEXTRA_CHARSETS = all slow query statement (my. cnf) long_query_time = 1 log_slow_queries =/usr/local/mysql/var/slow_query.log modify the File Permission chown-R mysql: mysql $ {dbname}