Skip to main content
Home
badllama.com
  • Search
  • Log In

MySQL 5.5 on Debian Lenny

bchavet's picture

Thu, 07/14/2011 - 18:19 by bchavet

Upgrading from MySQL 5.1

Backup Current Data

Create a backup of your database

mysqldump --opt --all-databases | gzip > ~/mysqldump.sql.gz

Make a separate backup of the `mysql` database, which will come in handy if any recovery operations are required.

mysqldump --opt --databases mysql | gzip > ~/mysql.sql.gz

Also, make a copy of the MySQL configuration files

tar -C /etc -czf /etc/mysql.tar.gz mysql

Remove MySQL 5.1

Now that there are sufficient backups, MySQL 5.1 can be uninstalled.

aptitude purge mysql-server-5.1 mysql-client-5.1

Prerequisites

The new InnoDB plugin provides Asynchronous I/O capabilities, but in order to take advantage of that, make sure libaio is installed

aptitude install libaio-dev libaio1

Install MySQL 5.5

Download the latest "Compressed TAR Archive" for your architecture at http://www.mysql.com/downloads/mysql/ (scroll to the bottom). At the time of this writing, 5.5.14 was the latest version.

Unpack this tarball to /usr/local

tar -C /usr/local -zxf mysql-5.5.*.tar.gz

Link it to /usr/local/mysql

ln -s /usr/local/mysql-5.5.* /usr/local/mysql

Fix the permissions

chown -R mysql: /usr/local/mysql

Link the bin tools to /usr/local/bin/

ln -s /usr/local/mysql/bin/* /usr/local/bin/

Copy the example MySQL configuration file to /etc

cp /usr/local/mysql/support-files/my-large.cnf /etc/mysql/my.cnf
ln -s /etc/mysql/my.cnf /etc/my.cnf

Edit or add the following entries in /etc/mysql/my.cnf, plus any other required customizations. Also, look for any references to /usr/share/mysql, and update them to refer to /usr/local/mysql/share.

[client]
socket = /var/run/mysqld/mysql.sock

[mysqld]
socket = /var/run/mysqld/mysql.sock
user = mysql
basedir = /usr/local/mysql
datadir = /var/lib/mysql
tmpdir = /tmp
log_error = /var/log/mysql.err

Install the init script

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
update-rc.d mysql defaults

Start MySQL 5.5

/etc/init.d/mysql start

Upgrade the internal table structures

/usr/local/bin/mysql_upgrade

That's It!

Verify that all of your data looks good, and clean up the backups if you are happy with the results.

Powered by Backdrop CMS