When MySQL 5.1 is upgraded to MySQL, the database must be backed up as an SQL file, and then data must be imported. Copying database files may cause some strange problems, such as Chinese garbled characters, table Corruption and other mysqldump upgrade authorization tables must be run in the old MySQL. /mysql_fix_privilege_tables -- Password = root_password -- basedir = new_mysql_basedir -- socket = old_mysql_sock old my backup. CNF and/etc/init. d/mysqld file MV my. CNF/etc/init. d/mysqld/backup/mysqlbackup/etc/
Install the configuration file and start the management script to copy MySQL under support-files. server to/etc/init. d/mysqld modify basedir and datadir values to the current MySQL path to copy the my-medium.cnf under support-files to/etc/My. CNF and modify the parameter values as needed
Start the server and check the error log. Generally, $ hostname. Err is used to import data to the database.
Upgrade mysql5.1 to 5.5 to remove the backup data file/etc/init. d/mysqld and/etc/My. copy the directory of mysql5.5 to/data/soft/mysql5.5 and copy my. CNF and MySQL. server to/etc/init. d/mysqld and/etc/My. modify mysqld and my. start MySQL to cancel the check on the Authorization Table mysqld -- skip-grant-tables -- user = MySQL to run mysql_upgrade to update the existing database. This takes a long time. It is best to import SQL data from other locations.
Start MySQL
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
[C-sharp] View
Plaincopy
$ 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
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 = MySQL
Socket =/var/run/mysqld. Sock
Port = 3306
Basedir =/usr/local/MySQL
Datadir =/usr/local/MySQL/Data
Tmpdir =/tmp
Log_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 skip grants when using MySQL server for the first time after installation table, there are 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 ~