Practice: mysql version upgrades
/*************************************** * ************ 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
How can I upgrade the MYSQL version on the server?
Dev.mysql.com/...g.html
Yourself. Mysql only reinstalls the program, and the database data is not moved.
However, we recommend that you use a virtual machine or test machine to test the upgrade process.
How to upgrade the mysql database?
I just answered a similar question the day before yesterday.
1. Export 4.0.23 current database data for backup.
2. Install 4.1 or 5.1 to import backup data.
3. Specific operations
Steps to upgrade MySQL in linux:
1. You should back up the current MySQL installation before upgrading.
2. download the latest linux version of MySQL.
3. You must stop the server before upgrading MySQL.
If the server is installed as a service, you must stop the service using the command in the command line at the command prompt:
4. when upgrading from 4.0.23 to 4.1 or 5.1 or from MySQL installed in the Zip file to MySQL installed in MySQL Installation Wizard (Installation help, you must manually uninstall the previously installed MySQL service.
If you do not want to uninstall the existing services, MySQL Installation Wizard (Installation help) will not correctly install the new MySQL service.
5. If you use MySQL Installation Wizard (Installation help), refer to the description of "use MySQL Installation Wizard" to start the help.
6. If you use a Zip file to install MySQL, extract the file. You can overwrite the existing MySQL installation. We recommend that you overwrite the original installation.
7. Restart the server.