Sunday, February 19, 2006

Installing Mysql 5.0 on Ubuntu 'Breezy' 5.10 via statically linked RPM's

Update: See this page for a howto on installing 'dapper' into a chroot on 'breezy'. This will allow you to simply 'apt-get install mysql-server' to install MySQL 5.0 under 'breezy'. Note, make sure you dont downgrade to a lower 5.0 point release (ie. if you followed these instructions below).

Installing MySQL 5.0 on Breezy isn't as simple as 'apt-get install'. Whilst MySQL 5.0 is available for the next Ubuntu release, 'Dapper', it has not been backported to Breezy. The Dapper packages have library dependencies that would break a Breezy system quite badly if updated. Here is a work-around that is good enough for me, until the April 2006 (?) release of Dapper. Install MySQL Server v4.1 and all dependencies from Breezy.

apt-get install mysql-server-4.1
This will install Mysql client and other required packages. The 4.1 client should be compatible with 5.0 Download the statically linked v5.0 RPM from MySQL AB: I downloaded from "Linux x86 generic RPM (statically linked against glibc 2.2.5) downloads"

Now remove the MySQL v4.1 server to make way for v5.0:

apt-get remove mysql-server-4.1
Make sure you have the RPM converter, Alien:

apt-get install alien
Convert the RPM to a DEB and install it with dpkg -i:

[email protected]:~/# alien MySQL-server-5.0.18-0.glibc23.i386.rpm
mysql-server_5.0.18-1_i386.deb generated
[email protected]:~/# dpkg -i mysql-server_5.0.18-1_i386.deb
(Reading database ... 73164 files and directories currently installed.)
Preparing to replace mysql-server 5.0.18-1 (using mysql-server_5.0.18-1_i386.deb) ...
Unpacking replacement mysql-server ...
Replaced by files in installed package mysql-server-5.0 ...
Replaced by files in installed package mysql-client-4.1 ...
Setting up mysql-server (5.0.18-1) ...

Start the MySQL v5.0 server and check we're up:

[email protected]:~/# /etc/init.d/mysql start
Starting MySQL *

[email protected]:~/Dropbox/Install Sort/mysql# netstat -ln | grep 3306
tcp 0 0* LISTEN

Great, its up. Almost there... the unix socket isn't placed where the debian MySQL client expects them. You can connect over TCP/IP using 'mysql -h127.0.0.1' or reconfigure the client:

[email protected]:~/# lsof | grep mysql | grep sock
mysqld 26152 mysql 15u unix 0xd1206280 614764 /var/lib/mysql/mysql.sock

Okay, so the unix socket is '/var/lib/mysql/mysql.sock'

[email protected]:/# nano /etc/mysql/my.cnf
Set the 'socket=' lines to reflect the socket location, as above.

[email protected]:~/# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11 to server version: 5.0.18-standard


Note: this shouldn't be used in a production environment, however its good enough for a couple of months on a development server.

No comments:

Post a Comment