**************************************** * ************ Upgrade mysql5619 to 5621 *********************** * ***************************** backup is required before the upgrade! ---- 1 view the data of the current mysql version
/*************************************** * ************ Upgrade mysql to 5.6.21 ********************* * ******************************/backup is required before the upgrade! ---- 1. view the data directory location of mysql in the current version: show variables like '% datadir %';/usr/local/mysql01/data/--- 2. install the new version MySQL2.1. install the yum-y install gcc-c ++ autoconf automake zlib * libxml * \ ncurses-devel libtool-ltdl-devel * make cmake bison- devel libaio 2. 2. create a group and user for mysql # groupadd mysql # useradd-g mysql 2. 3. set the user's system resource limit # vi/etc/security/limits. confmysql soft nproc 2047 mysql hard nproc 16384 mysql soft nofile 1024 mysql hard nofile 655362. 4. build install new version mysqltar xvf mysql-5.6.21.tar.gzcd mysql-5.6.21 build install to new location cmake \-DCMAKE_INSTALL_PREFIX =/usr/local/mysql02 \-DMYSQL_DATADIR =/usr/local/mysql02/data \-DSYSCONFDIR =/ etc \-nodes = 1 \-DWITH_INNOBASE_STORAGE_ENGINE = 1 \-DWITH_MEMORY_STORAGE_ENGINE = 1 \-DWITH_READLINE = 1 \-DMYSQL_UNIX_ADDR =/usr/local/mysql02/mysql. sock \-prop = 3306 \-DENABLED_LOCAL_INFILE = 1 \-prop = 1 \-DEXTRA_CHARSETS = all \-DDEFAULT_CHARSET = utf8 \-DEXTRA_CHARSETS = all \-DDEFAULT_COLLATION = uninstall make install2.5 version mysqlservice mysqld stop ---- 3. configure MySQL3.1. modify/usr/local/mysql permissions # mkdir-p/usr/local/mysql023.2. create a data file, temporary file mkdir/usr/local/mysql02/{innodb_data, data, tmp}-pmkdir/usr/local/mysql02/mysql_logs/{binary_log, innodb_log, query_log, logs, error_log}-p3.3. modify permissions for cd/usr/local/mysql02chown-R mysql. chgrp-R mysql. 3. 4. modify the parameter # vi/etc/my. cnf basedir =/usr/local/mysql # specify the database installation directory to the new version of the installation directory datadir =/var/lib/mysql # keep the original database data directory to skip-grant -tables # as required by the upgrade, skip permission verification SQL _mode = NO_ENGINE_SUBSTITUTION. in STRICT_TRANS_TABLES, # Remove STRICT_TRANS_TABLES. disable the strict data mode. # you only need to modify these settings. do not modify other settings. if you need to transfer logs to a new directory, 3. 5. overwrite the startup file # cp/usr/local/mysql02/support-files/mysql. server/etc/init. d/mysqld 3. 6. execute table permission upgrade # service mysqld start # Restart the new MySQL version #/usr/local/mysql02/bin/mysql_upgrade # execute table permission upgrade 3. 7. check all databases #/usr/local/mysql02/bin/mysqlcheck -- all-databases-uroot-p123456 3. 8. restart mysql # vi/etc/my. cnf remove skip-grant-tables # service mysqld restart # database upgrade successful