Ubuntu – Problem with restarting MySQL server installed through aptitude on Ubuntu Lucid Lynx

MySQLUbuntuubuntu-10.04

I'm using Ubuntu Lucid Lynx (10.04) and installed MySQL server through aptitude.
The installation automatically added a user called mysql (it didn't exist in /etc/passwd file at the beginning and it exists there after the installation.) and started MySQL server.

Then I needed to modify my.cnf (in order to enable remote access to the MySQL server).
When I restarted MySQL server with

$ sudo /etc/init.d/mysql restart

it hang. But displaying processes by "top" command in another terminal indicated that MySQL server was running with root user. But my.cnf clearly sets

user = mysql

Then I tried

$ sudo service mysql restart

And the result was even worse. It didn't start the MySQL server at all.

As far as I remember, I have never encountered such a problem in the previous versions of Ubuntu.

So my questions are:

  1. How can I start MySQL server with a user called mysql in Ubuntu Lucid Lynx (10.04)?

  2. Which is the most reliable way to start MySQL server in Ubuntu Lucid Lynx (10.04),

    /etc/init.d/mysql start

    or

    service mysql start

    or

    start mysql

    and what is the difference?

Thank you in advance.

Tadatoshi

Best Answer

/etc/init.d/xxxx start is used to start services using SysV init scripts. Ubuntu uses upstart instead of SysV init and the init scripts are getting converted to native upstart jobs. Usually the init scripts for converted jobs display a warning and call upstart.

start xxxx is used with services using upstart and doesn't work with services using SysV init.

service xxxx start automatically chooses the right one, so it's safe to always use service

As far as I know MySQL has been converted to use upstart in 10.04

Related Topic