/*****************************************************mysql 5.6.19 upgrade to 5.6.21************************************ /Pre-upgrade is required!----1. View the existing version of MySQL data directory location show variables like '%datadir% ';/usr/local/mysql01/data/--- 2. Install the new version MySQL2.1. Package required to install the compiled code yum-y install gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel* Make CMake Bison bison-devel Libaio 2.2. New group for MySQL and user #groupadd mysql#useradd-g MySQL mysql 2.3. Set the user's system resource limits #vi/etc/securi Ty/limits.confmysql soft Nproc 2047mysql hard nproc 16384mysql soft nofile 1024mysql hard Nofile 655362.4. Compile and install the new version Mysqltar XVF MYSQL-5.6.21.TAR.GZCD mysql-5.6.21 Compile and install to the new location Cmake-dcmake_ Install_prefix=/usr/local/mysql02-dmysql_datadir=/usr/local/mysql02/data \-DSYSCONFDIR=/ETC-DWITH_MYISAM_ Storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_unix_ Addr=/usr/local/mysql02/mysql.sock-dmysql_tcp_port=3306-denabled_local_infile=1-dwith_partition_storage_engine=1-dextra_charsets=all-ddefault_charset=utf8-dextra_charsets= All-ddefault_collation=utf8_general_cimake make install2.5 Stop the old version mysqlservice mysqld stop----3. Configure MySQL3.1. Modify/usr/ Local/mysql permissions #mkdir-p/usr/local/mysql023.2. New data file, temporary file mkdir/usr/local/mysql02/{innodb_data,data,tmp}-pmkdir/ Usr/local/mysql02/mysql_logs/{binary_log,innodb_log,query_log,slow_query_log,error_log}-p3.3. Modify Permissions cd/usr/local/ Mysql02chown-r MySQL. chgrp-r MySQL. 3.4. Modify parameters #vi/etc/my.cnf Basedir =/usr/local/mysql# Database installation directory Specify the installation directory to the new version DataDir =/ Var/lib/mysql #原数据库数据目录保持原来的目录即可 skip-grant-tables #由于升级需要, skip permission validation sql_mode=no_engine_substitution,strict_trans_ TABLES #去掉STRICT_TRANS_TABLES, disable the data strict mode #只需要修改这些, the other generally do not need to modify, if you need to transfer the log and the like to the new directory, then modify 3.5 as needed. Overwrite the startup file #cp/usr/local/mysql02 /SUPPORT-FILES/MYSQL.SERVER/ETC/INIT.D/MYSQLD 3.6. Perform table permissions upgrade #service mysqld start #重启新版本MySQL #/usr/local/mysql02/bin/ Mysql_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 #数据库升级成功
Actual combat: MySQL Version upgrade