This article describes how to upgrade MySQL5.1 to MySQL5.5 in CentOS. For more information, see mysql 5.5, especially for multi-core CPU support and TPS performance improvement. Last week, the blogger introduced how to compile and install mysql 5.5 in linux. there is no problem with installation. However, many of my friends may have been using mysql 5.1 like me. now I want to upgrade the database to 5.5. The blogger records the upgrade operation based on the actual operation.
Basic mysql information
1. installation directory
[Root @ vm-199 ~] #/Usr/local/mysql
2. configuration file
[Root @ vm-199 ~] #/Etc/my. cnf
3. Data Directory
[Root @ vm-199 ~] #/Data/mysql
4. start the script
[Root @ vm-199 ~] #/Etc/init. d/mysql
Backup data and installation and configuration files
[Root @ vm-199 ~] # Mysqldump-uroot-p-all-databases[Root @ vm-199 ~] # Tar czvf mysql_5.1.60_full.tar.gz/usr/local/mysql
[Root @ vm-199 ~] # Tar czvf mysql_5.1.60_data_full.tar.gz/data/mysql
[Root @ vm-199 ~] # Cp/etc/my. cnf ./
After the data is backed up, close the mysql database,/etc/init. d/mysql stop, and delete the/usr/local/mysql file.
Install mysql 5.5
Specific can refer to this article "Linux compilation and installation of Mysql-5.5 simple steps", installation directory, Data Directory and 5.1 are the same, are/usr/local/mysql.
Update configuration file
[Root @ vm-199] # cp support-files/mysql-5.5.35/etc/my. cnf
Add the data directory datadir =/data/mysql to the configuration file.
Start mysql 5.5, execute the update program, and restart mysql
The code is as follows:
[Root @ vm-199 mysql-5.5.35] #/etc/init. d/mysql start
[Root @ vm-199 mysql-5.5.35] #/usr/local/mysql/bin/mysql_upgrade
Looking for 'mysql' as:/usr/local/mysql/bin/mysql
Looking for 'mysqlcheck' as:/usr/local/mysql/bin/mysqlcheck
Running 'mysqlcheck' with connection arguments: '-- port = 100'' -- socket =/tmp/mysqld. sock'
Running 'mysqlcheck' with connection arguments: '-- port = 100'' -- socket =/tmp/mysqld. sock'
Mydb. t1 OK
Mydb. t2 OK
Mysql. columns_priv OK
Mysql. db OK
Mysql. event OK
Mysql. func OK
Mysql. general_log OK
Mysql. help_category OK
Mysql. help_keyword OK
Mysql. help_relation OK
Mysql. help_topic OK
Mysql. host OK
Mysql. ndb_binlog_index OK
Mysql. plugin OK
Mysql. proc OK
Mysql. procs_priv OK
Mysql. proxies_priv OK
Mysql. servers OK
Mysql. slow_log OK
Mysql. tables_priv OK
Mysql. time_zone OK
Mysql. time_zone_leap_second OK
Mysql. time_zone_name OK
Mysql. time_zone_transition OK
Mysql. time_zone_transition_type OK
Mysql. user OK
Running 'MySQL _ fix_privilege_tables '...
OK
So far, mysql has been updated. Log on to mysql and check whether the data is the same as the original one.
This mysql upgrade is not complicated. In fact, it is to reinstall it and overwrite the data directory file. However, during database upgrade, you must pay attention to data backup to prevent data and accidental loss.