Ever since Mandriva Linux 2008 Spring, the MySQL server included with the popular distro won't play out of the box (on most end-user systems, I have to be fair). If you try to spawn the service automatically, it will give you no reason as to why it won't start, causing a lot of frustration. Trying to spawn it manually with service mysqld start from a root command line will give you a nice, cryptic reply like:
ERROR: hostname cannot be localhost, mysql_install_db is quite unstable
Well... following the link to the Mandriva bug page will cause even more confusion! However, the solution is really, really simple! Just read on ;). This solution may apply to other distributions as well, but it has only been tested in Mandriva Linux 2008.1 and 2009.0
The reason is that Mandriva reverted to the default my.cnf distributed with MySQL, meaning that a) it defaults to no networking (it's like saying "forget remote connections if you're a lazy newbie") and b) It refuses to work on systems whose hostname is localhost, that is 99,9% of end-user systems! Here's the solution. You'll have to edit the file /etc/my.cnf as root.
Change the last line, reading something like
in order to force MySQL to bind to the localhost address. Note that the new line does not have a hash sign in front of it! Save and restart MySQL. Presto!
Now, let's move on to more advanced stuff. If you'd like to access MySQL off the net, change 127.0.0.1 above with your PC's IP (obviously, static IP's are mandatory with this approach; I haven't figured out how to make it properly work using DHCP-given IP's). What's more, locate the line reading
and change it to
in order to enable TCP/IP networking. Note that the new line only has a hash mark prepended to deactivate this directive. Save, reload MySQL, enjoy!
If you enjoyed this article, don't hesitate to comment it!