How do I pin a particular MySQL version to avoid unnecessary upgrades?

Posted by asparagino on Ask Ubuntu See other posts from Ask Ubuntu or by asparagino
Published on 2011-01-27T20:34:47Z Indexed on 2011/02/01 23:34 UTC
Read the original article Hit count: 570

Filed under:
|
|
|

I'm running a MySQL server, and want to keep it up to date with regular apt-upgrades. I don't want this to cause MySQL to upgrade unless I'm doing it during scheduled downtime! How do I alter my apt-preferences so that this won't happen?

I've tried adding this to a file as /etc/apt/preferences.d/pin-mysql

Package: mysql-client-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001

Package: mysql-client-core-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001

Package: mysql-common
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001

Package: mysql-server
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001

Package: mysql-server-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001

Package: mysql-server-core-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001

That then states the packages are pinned with "apt-cache policy" outputting:

... all package sources here
 500 http://security.ubuntu.com/ubuntu/ lucid-security/universe Packages
     release v=10.04,o=Ubuntu,a=lucid-security,n=lucid,l=Ubuntu,c=universe
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu/ lucid-security/restricted Packages
     release v=10.04,o=Ubuntu,a=lucid-security,n=lucid,l=Ubuntu,c=restricted
     origin security.ubuntu.com
... etc
Pinned packages:
     mysql-server -> 5.1.41-3ubuntu12.7
     mysql-server-core-5.1 -> 5.1.41-3ubuntu12.7
     mysql-client-core-5.1 -> 5.1.41-3ubuntu12.7
     mysql-common -> 5.1.41-3ubuntu12.7
     mysql-server-5.1 -> 5.1.41-3ubuntu12.7
     mysql-client-5.1 -> 5.1.41-3ubuntu12.7

However... running aptitude safe-upgrade just updated MySQL... what am I doing wrong?

© Ask Ubuntu or respective owner

Related posts about apt

Related posts about aptitude