Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I follow instruction in that blog upgrade from mysql5.1 to mysql5.5:

Step 1. Remove existing MySQL 5.1 retaining data and configuration
sudo su
service mysql stop
cp -r /etc/mysql /etc/mysql.51
cp -r /var/lib/mysql /var/lib/mysql.51
which mysqld
dpkg -P mysql-server mysql-server-5.1 mysql-server-core-5.1
which mysqld
which mysql
dpkg -P mysql-client-5.1 mysql-client-core-5.1
which mysql
dpkg -P libdbd-mysql-perl libmysqlclient16 mysql-common
# This will not remove /etc/mysql if any other files are in the directory
dpkg -l | grep mysql
[ -d /etc/mysql ] && mv /etc/mysql /etc/mysql.uninstall
cp -r /etc/mysql.51 /etc/mysql

2. Prepare configuration and required directories.
sudo su 
grep basedir ${MYCNF}
sed -ie "s/^basedir.*$/basedir=\/opt\/mysql/" ${MYCNF}
grep basedir ${MYCNF}
sed -ie "/^\[mysqld_safe\]/a\
skip-syslog" ${MYCNF}
chown -R mysql:mysql /var/lib/mysql
mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld

3. Install MySQL 5.5
sudo su -
mkdir -p /opt
cd /opt
# Install MySQL 5.5 Binaries
apt-get install -y libaio-dev  # New 5.5 dependency
tar xvfz mysql*.tar.gz
ln -s mysql-5.5.28-linux2.6-x86_64 /opt/mysql
echo "export MYSQL_HOME=/opt/mysql
export PATH=\$MYSQL_HOME/bin:\$PATH" > /etc/profile.d/
chmod +x /etc/profile.d/
. /etc/profile.d/
echo $PATH
which mysql

4. Upgrade and verify MySQL Instance
su - mysql
bin/mysqld_safe --skip-syslog &
tail /var/log/mysql/error.log
# There will be some expected ERRORS in error log
bin/mysql_upgrade -uroot
bin/mysqladmin -uroot  shutdown
bin/mysqld_safe --skip-syslog &
tail -100 /var/log/mysql/error.log
mysql -uroot -e "SELECT VERSION();"
bin/mysqladmin -uroot  shutdown

5. Setup MySQL for system use
# As Root
sudo su
cp /opt/mysql/support-files/mysql.server ${INIT}
sed -ie "s/^basedir=$/basedir=\/opt\/mysql/;s/^datadir=$/datadir=\/var\/lib\/mysql/" ${INIT}
${INIT} start
mysql -uroot -e "SELECT VERSION();"
${INIT} stop

But get that errors:

type in terminal: mysql
get:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

type in terminal: sudo /etc/init.d/mysqld stop
get:* MySQL server PID file could not be found!

Please help me. Thanks

share|improve this question
You really should be using proper packages when installing software, and not random tarballs. If you really need MySQL 5.5 you should just upgrade to Ubuntu 12.04 (which is LTS) and install the provided packages. – mgorven Feb 21 '13 at 18:40
in latest ubuntu version the upgrade making problems – Yosef Feb 21 '13 at 23:13
What is that problem? – quanta Feb 22 '13 at 7:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.