Install MySQL 5.5 on Ubuntu

March 8th, 2011 by Manoj Chauhan Leave a reply »

I followed the steps on this page to install MySQL 5.5 on Ubuntu.
To install and use a MySQL binary distribution, the basic command sequence looks like this:

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe –user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

Here are some problems I had during the installation.

1. mysqld: error while loading shared libraries: cannot open shared object file: No such file or directory
I Fixed after installing libaio1: sudo apt-get install libaio1

2. When I was trying to run /usr/local/mysql/scripts/mysql_install_db –user=mysql to reate the data dictionary

This command gives the following error:
FATAL ERROR: Could not find mysqld

The following directories were searched:


Fix: Find and remove the old my.cnf file.
sudo rm /etc/mysql/my.cnf, because it was getting the details from the /etc/my.cnf

Don’t forget to set your root password.
./bin/mysqladmin -u root password ‘new-password’

  • DColeman

    Hey. I find this very useful since I am running into a bunch of issues with MySQL bugs that look similar to what you described.

    But here is the thing. Where did you find .tar.gz packages. I keep running into rpm’s that I need to install with alien and even that causes different problems.



  • Manoj Chauhan

    You can download the source from the mysql site. Please let us know if you have any issue.

  • Ant

    nice, been struggling with this problem


  • Julian V. Jupiter

    I ran ‘sudo apt-get install libaio1′, it threw the ff message:

    Reading package lists… Done
    Building dependency tree       
    Reading state information… Done
    Package libaio1 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘libaio1′ has no installation candidate

    I also ran apt-get update, it said:

    E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)
    E: Unable to lock directory /var/lib/apt/lists/

    I’ve been struggling in installing binary mysql, particularly in:
    scripts/mysql_install_db –user=mysql

    Please help. Thanks.


    thanks old man, it’s very important to know what problems arrive intalling my without apt-get install. Exelent Post!!!

blog comments powered by Disqus