Installing MySQL on Ubuntu Linux

Hi

I’m having trouble installing MySQL Community Server on Ubuntu Linux. I’m following the intstructions from Build Your Own Database Driven Web Site Using PHP & MySQL, 4th Edition - SitePoint Books.

First off, it says to look for a tar.gz file, and there isn’t one.

When I use the .tar file that the website recommends for linux, the terminal complains that its not a tar.gz file.

I did try a tar.gz file from way down the list of downloads, but this didn’t work either. When I got to the stage of installing the database files, it couldn’t find the right directory.

Can anyone help?

if you’re using Ubuntu you can use the package manager to install programs instead of manually building them.

try running the following as root:

apt-get install mysql-server-5.0

Are there disadvantages to doing this though. The book I’m reading says this limits the user configuration options. Also, the package manager only has version 5.1 whereas the latest version is 5.5.9. Do these things matter?

5.1 is stable. Make sure to set a root password in mysql once you’ve installed it.

Ok, I’ve used the older version, but I get the following error when I try to install the databases:

root@sam-AMILO-Li-2727:/usr/local/mysql# scripts/mysql_install_db --user=mysql

FATAL ERROR: Could not find mysqld

The following directories were searched:

    /usr/libexec
    /usr/sbin
    /usr/bin

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

I did try the package version, but I couldn’t find where mysql was located, and I needed to in order to carry out tasks later in the chapter.

FYI I’m on Ubuntu 10.10

Ok, I’ve started again. In fact, I’ve re-installed Ubuntu 10.10 and downloaded MySQL again. Here is my entire installation process up until when I hit trouble:

sam@sam-AMILO-Li-2727:~$ cd /usr/local
sam@sam-AMILO-Li-2727:/usr/local$ sudo su
[sudo] password for sam:
root@sam-AMILO-Li-2727:/usr/local# tar xfz ~sam/Desktop/mysql-5.5.9-linux2.6-i686.tar.gz
root@sam-AMILO-Li-2727:/usr/local# ln -s mysql-5.5.9-linux2.6-i686 mysql
root@sam-AMILO-Li-2727:/usr/local# cd mysql
root@sam-AMILO-Li-2727:/usr/local/mysql# groupadd mysql
root@sam-AMILO-Li-2727:/usr/local/mysql# useradd -g mysql mysql
root@sam-AMILO-Li-2727:/usr/local/mysql# chown -R mysql .
root@sam-AMILO-Li-2727:/usr/local/mysql# chgrp -R mysql .
root@sam-AMILO-Li-2727:/usr/local/mysql# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

Installation of system tables failed!  Examine the logs in
./data for more information.

You can try to start the mysqld daemon with:

    shell> ./bin/mysqld --skip-grant &

and use the command line tool ./bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> ./bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in ./data that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us!  And remember, if
you do mail us, you MUST use the ./bin/mysqlbug script!

It is pretty much identical to the instructions in the Sitepoint book. Does anyone know why this isn’t working. Please help, I’m in despair!

You’re missing a shared library…
you could try

apt-get install libaio1

if you use the package manager it would grab all these dependencies for you, and should automatically create users etc…