---
title: "Debian Lenny, Virtualmin & MySQL 5.1"
date: "2010-08-09"
modified: "2013-03-04"
path: "/57-debian-lenny,-virtualmin-mysql-5-1.html"
section: "/ramblings"
aliases:
  - "/57"
  - "/57-debian-lenny,-virtualmin-mysql-5-1"
  - "/57.html"
  - "/ramblings/57-debian-lenny,-virtualmin-mysql-5-1.html"
---

If you need the latest MySQL version for having cached prepared statements, you may need to follow a process of replacing your existing server:

Edit `/etc/apt/sources.list`

Add the following:

```
deb http://packages.dotdeb.org lenny all
```

Do an update of the packages:

```
apt-get update
```

Watch it fail and run (replacing key with the one output from above):

```
gpg --keyserver pgpkeys.mit.edu --recv-key E9C74FEEA2098A6E
gpg -a --export E9C74FEEA2098A6E | apt-key add -
```

The a test install:

```
apt-get -s install mysql-server-5.1
```

Shows that: 2 upgraded, 4 newly installed, 3 to remove and 11 not upgraded.

You should probably stop the server if it is presently running:

```
/etc/init.d/mysql stop
```

Now run:

```
apt-get install mysql-server-5.1
```

<div class="box box-hint">
<p>It's possible we may need to also upgrade php5-mysql but looking at what might get updated there could be issues:</p>
<code>apt-get -s install php5-mysql</code>
<p>Stating: 8 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.</p>
<p>In my case this will probably break the existing self-compiled php5-gd module. I have ignored this step.</p>
</div>

Remove/comment the line from the `/etc/apt/sources.list`

Do an update of the packages:

```
apt-get update
```

Examine running server using phpmyadmin or `mysql -v`

References:

http://www.monkeedev.co.uk/blog/2009/03/23/installing-mysql-51-on-debian-and-ubuntu-using-apt/<br>
http://howtoforge.com/a-short-introduction-to-apt-pinning
