HOWTO: Install recent Mysql Community 5.0.x in Debian Etch

EDIT: If you want to upgrade a 5.0.x installation on Etch, forget this howto and use the packages provided by http://www.backports.org which is the official way to do it. You may still use this howto as an inspiration if you plan to install Mysql 5.1.x, until it get backported ;) (although I doubt it will ever be).
Anyway, for the lazy:

  • Add this line to /etc/apt/sources.list

    deb http://www.backports.org/debian etch-backports main contrib non-free
  • Then execute these commands:
    apt-get update
    apt-get -t etch-backports install mysql-server

THIS IS DEPRECATED!!If you install a Debian 4.0 (Etch) system and you do an apt-get install mysql-server you will install an old 5.0.32 version. So, since we know there are a couple of critical bugs fixed in more recient versions (solving for example scalability issues on SMP machines), you may want to install a more recent version from the official Mysql Community web site. This link will let you download a dinamically-linked RPM which needs glibc 2.3, which is the version we have in our Etch system.After the download, install the Alien tool
apt-get install alienand then magically convert the RPM to a DEB package withalien --scripts MySQL-server-5.0.*.glibc23.i386.rpmand in a couple of minutes you will have a new mysql-server_5.0.45-1_i386.deb (for example, the number depends on the Mysql version you have downloaded and the architecture you are using).Now, let’s install the old, default Debian mysql version, with

apt-get install mysql-server
that will install mysqld in the Debian way and create all the things it needs.

WARNING:
Before proceding furthermore, we have to remove the mysql-server-5.0 package with

apt-get remove mysql-server-5.0

This is needed because otherwise when upgrades to this package appear in the official Debian repository, you will be forced to install them (if you’re not using pinning) even if you don’t need them. Why? Because the mysql-server package that we’re replacing in this howto is only a meta-package for mysql-server-5.0 which is in Debian the real package. I’m working on a better solution, I’ll keep you informed.

Now, with the deb we have just generated with Alien, we can update the Debian installation, since they both provide the same package (mysql-server)

Install it with:

dpkg -i --force-overwrite mysql-server_*i386.deb

the –force-overwrite is needed because there are files in conflict between the Debian meta-package mysql-server-5.0 and the deb we are installing right now. This could be solved modifying the manifesto of our debian package telling the system that our deb provides a mysql-server-5.0 installation or, since the original RPM is LSB-compliant, with this force-overwrite option.

Now, let’s stop the mysql daemon just a moment

/etc/init.d/mysql stop

create this symlink (because the RPM init script will look for /etc/my.cnf)

ln -s /etc/mysql/my.cnf /etc/my.cnf

and then let’s start again Mysql

/etc/init.d/mysql start

and that’s all, it should work (at least it worked for me).

Advertisement

10 thoughts on “HOWTO: Install recent Mysql Community 5.0.x in Debian Etch

  1. You are my new best friend, whoever you are! I’ve been trying for several days to get mysql 5 up and running on a fresh etch install and kept getting a message “Checking for corrupt, not cleanly closed and upgrade needing tables”. ps said mysql was running but netstat didn’t list it as listening. Couple minutes after finding this page, i’m up and running, thanks!

  2. I’m glad it worked for you too :) Maybe I should try to fix the –force-overwrite need, I’ll update this post if get it.

  3. “Checking for corrupt, not cleanly closed and upgrade needing tables”
    this is the normal statement from MySQL when it is starting up. Nothing to worry about.

    “netstat didn’t list it as listening”
    The original debian packages have “skip-networking” configured or are just listening on localhost for security reasons. If you need to access mysql through network you would want to change this configuration.

    Marco

  4. What about addititonal packages from Debian:
    libdbd-mysql-perl, libdbi-perl, libnet-daemon-perl, liblrpc-perl
    of course I can install them separatelly. I do not know, do we need them?

  5. As I said, using backports this is not a problem. The mysql-server meta-package has all the dependencies correctly set (in fact, it’s the mysql you’ll have in the next stable, IIRC). So apt-get -t etch-backports install mysql-server and everything will work smoothly.

  6. OK I’m used aptitude – as recommended for Debian Etch. The command “aptitude remove mysql-server-5.0” removes not only the server and some perl libraries but client applications also, such as mysql itself :(
    I have been reinstall them, with a little fear about version incompatibility.
    aptitude install ibdbd-mysql-perl libdbi-perl libnet-daemon-perl liblrpc-perl
    and
    aptitude install mysql-client-5.0
    I’m quite new in mysql, I need struggling toward to make this stuff usable – migrate from mysql for windows 3.x

  7. hmm it gives a error:

    * /etc/init.d/mysql: ERROR: Using expire_logs_days without log_bin crashes the server. See README.Debian.gz

  8. Thanks for this howto. It guided me through installing MySQL 5.5.1 on Debian Lenny. I did have to take the additional step of changing the permissions on the /var/lib/mysql/mysql directory.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s