Upgrade MySQL to MySQL 5.5

Source: Internet
Author: User

Lai Yonghao (http://laiyonghao.com)

This article is basically the translation of this (http://www.ovaistariq.net/490/a-step-by-step-guide-to-upgrading-to-mysql-5-5.

 

 

MySQL 5.5 not only promotes the work well, but also greatly improves the performance of the MySQL server itself, and the performance of the Inno dB plug-in also increases. But there is no good guide for upgrading to MySQL 5.5, so I wrote one myself, which is no big deal!

1. Download the binary installation package

$ CD/root/$ wget invalid MV index.html mysql-5.5.8-linux2.6-i686.tar.gz

2. Back up the MySQL configuration file

$ Mkdir/root/mysql-5.1-conf $ CP-r/etc/MySQL // root/mysql-5.1-conf

3. Backup Data Directory

$ Mkdir/root/mysql-5.1-data $ CP-r/var/lib/MySQL // root/mysql-5.1-data

4. Back up data

$ Mkdir/root/mysql-5.1-dump $ mysqldump-u user_name-p -- databases mysql>/root/mysql-5.1-dump/MySQL. SQL $ mysqldump-u user_name-p -- database Database Name>/root/mysql-5.1-dump/db_name. SQL

5. Install the asynchronous I/O Library

MySQL 5.5's new Inno dB uses libaio to improve performance

$ Apt-Get install libaio-Dev

6. Unpack

$ Tar xzvf mysql-5.5.8-linux2.6-i686.tar.gz

7. Put the MySQL directory to the installation directory.

$ CP-r mysql-5.5.8-linux2.6-i686/usr/local/$ CD/usr/local/$ ln-s mysql-5.5.8-linux2.6-i686 MySQL

8. Delete the old MySQL version.

$ Apt-Get remove mysql-server-5.1 $ apt-Get autoremove $ apt-Get remove mysql-client $ apt-Get autoremove

9. Add the MySQL bin directory to the path environment variable.

$ Vim/etc/environmentpath = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: /usr/games:/usr/local/MySQL/bin"

10. Set correct permissions for MySQL installation directories and files

$ CD/usr/local/MySQL $ chown-r MYSQL: MySQL DATA

11. Create a socket directory

Remind me again, remember to set permissions

$ Mkdir/var/run/mysqld/$ chown-r MYSQL: MySQL/var/run/mysqld/

12. Copy the MySQL sample configuration to the etc directory and set the path.

$ CD/usr/local/MySQL/support-files/$ CP my-large.cnf/etc/My. CNF

Edit/etc/My. CNF with the following values:

User = mysqlsocket =/var/run/mysqld. sockport = 3306 basedir =/usr/local/mysqldatadir =/usr/local/MySQL/datatmpdir =/tmplog_error =/var/log/MySQL/error. log

13. Copy the MySQL server startup script to the startup directory.

$ CD/usr/local/MySQL/support-files/$ CP MySQL. server/etc/init. d/MySQL $ chmod + x/etc/init. d/MySQL $ update-rc.d MySQL ults

14. delete old MySQL files

$ Rm-r/var/lib/MySQL $ Rm-r/etc/MySQL $ Rm-r/usr/lib/MySQL

When using MySQL server for the first time after installation, remember to skip the grants table for two reasons: first, we may want the original user and permission data, and second, the structure of the new grants table has changed.

15. Start MySQL without the grants table

$ Mysqld -- skip-grant-tables -- user = MySQL

16. Load MySQL user and permission data from the backup

$ CD/root/mysql-5.1-backup/dump/$ mysql <mysql. SQL

17. Run the update script to upgrade everything to Version 5.5.

$ Mysql_upgrade

18. stop and start MYSQL as usual

$/Etc/init. d/MySQL stop $/etc/init. d/MySQL start

So far, the upgrade is complete. If you upgrade to 5.5, please share your experience ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.