Friday, July 17, 2009

mysql-5.1.36 in Ubuntu 9.04: FATAL ERROR: Could not find mysqld

I was building mysql-5.1.36 in Ubuntu 9.04 - the Jaunty Jackalope. I was following the instructions given in INSTALL-SOURCE provided with the package. I was trying to create the MySQL data directory and initialize the grant tables by running this command:

$ sudo bin/mysql_install_db --user=mysql

I got this error:

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 of the level of the extracted archivem or pass the --basedir option pointing to that location.

After a bit googling and investigation, I found that this package mysql-common was already installed with
Ubuntu 9.04 and there is a file my.cnf in /etc/mysql and db initialization was using this file instead of the one I copied to /etc with this command while following the INSTALL-SOURCE file:

$ sudo cp support-files/my-medium.cnf /etc/my.cnf

So the quick fix was to replace /etc/mysql/my.cnf with /etc/my.cnf that I copied earlier. I did these:

$ sudo mv /etc/mysql/my.cnf /etc/mysql/my_backup.cnf
$ sudo cp /etc/my.cnf /etc/mysql/

4 comments:

Unknown said...

Thank You. It works!

aksural7 said...

thanks a lot :D
thats really help me.

Unknown said...

It helps! Thank a million!

DarRay said...

Thanks this helped me a lot.. I was trying to install mysql 5.1 to ubuntu 12.04 and replaced already installed mysql 5.5 following above steps..