Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Thank you to samt for solving the first problem with chown!

I run the command

$sudo /opt/local/bin/mysqld_safe5 &                                                                                                                      ~ 
[1] 1096
$Password:                                                                                                                                              ~ 1

[1]  + suspended (tty output)  sudo /opt/local/bin/mysqld_safe5

The process is now at the jobs for some reason, so I get it back

$%1                                                                                                                                                     ~ 1
    [1]  + continued  sudo /opt/local/bin/mysqld_safe5
    Starting mysqld daemon with databases from /opt/local/var/db/mysql5
    STOPPING server from pid file /opt/local/var/db/mysql5/
    090705 12:37:45  mysqld ended

I do not know why my MySQL is shutting down.

Do you know why my MySQL is shutting down?

share|improve this question
I am trying to start my MySQL other way too. I opened a problem about that at… – Masi Jul 5 '09 at 9:50
up vote 1 down vote accepted

Here's some basic stuff, so apologies if you've already tried them.

  • Try

    $ sudo su

    # /opt/local/bin/mysqld_safe5

    If this works then there may be a problem with the way PATH is set when using sudo

  • Is 'chown' in your filesystem (you identify the manual pages and package are on, but don't explicity identify that it is on the system)

    • I don't know how it's done on the Mac OS/X but you could try 'locate' and 'which', or 'find'

    locate chown

    will search a database of the filesystem to see if 'chown' has been 'indexed'

    which chown

    will search your PATH to see whether the filename 'chown' is in your path

    find / -type f -name chown

    is the hardway and traverses your hard disk looking for a filename chown

  • Check the PATH setting in /opt/local/bin/mysqld_safe5

    • some startup scripts set their own PATHs, and if the 'chown' is not explicitly pathed, then the system will traverse the scripts PATH not your's or SUDO's
  • Check your sudo settings, the environment settings there (i.e. including PATH) may be more explicit.

share|improve this answer
@samt: What do you mean by "sudo settings"? --- Which variables do you mean at environment settings? – Masi Jul 4 '09 at 21:52
which chown suggests me that there is no chown in my Mac. This is strange, since I have its manual in my Mac. – Masi Jul 4 '09 at 21:54
chown should be available at /usr/sbin/chown unless something has modified your installation of OS X. – Chealion Jul 5 '09 at 5:50
@Masi: Check that sudo is actually on your machine (as per Chealion) and check whether /usr/sbin is in your path. sudo let's the system allow unprivileged users to execute programs at an elevated level (e.g. as root privilege) and as a safety precaution 'sudo' can be configured to provide specific environments (e.g. remove certain Environment settings, change others, like removing/changing the PATH environment.) /etc/sudoers normally tells you what your user account can do, for online manual pages/samples. – samt Jul 5 '09 at 8:35
I did not have /usr/sbin/ in my PATH. Thank you for pointing that out! – Masi Jul 5 '09 at 9:09

chown: command not found

That suggests to me that chown is not in the path for the user account running the startup script. Try editing that script to use the full path.

share|improve this answer

If you installed mysql using MacPort I would really suggest you to use the package installer from MySQL website

share|improve this answer
I port uninstall MacPort's MySQL and I installed the MySQL by the package installer. --- I get the same error message. It seems that I have now the newest MySQL. – Masi Jul 4 '09 at 17:31
Did you read the read me file ? "If you have installed the Startup Item, use this command: shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start" or "If you don't use the Startup Item, enter the following command sequence: shell> cd /usr/local/mysql shell> sudo ./bin/mysqld_safe" – radius Jul 5 '09 at 12:43

Under OS X daemons are controlled by launchd, try this (you may have to adjust it slightly for your version of mysql installed)

sudo -u mysql mysql_install_db5
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist5

If these files are not available then you may not have the +server variant of the mysql5 port.

sudo port install mysql5-server
share|improve this answer
I get the following warnings in running the commands: – Masi Jul 5 '09 at 9:09
@Masi: Those two warning simply state that the launchd plist was never installed (more than likely you installed MySQL through MacPorts or Fink instead of the official package as seen in the answer) – Chealion Jul 6 '09 at 4:16

try lunching

sudo /opt/local/bin//mysqld --verbose

skip & - do not put it in background, just open separate console for it. maybe verbose output will provide you with helpful error msgs.

share|improve this answer
I get sudo: /opt/local/bin/mysqld: command not found. – Masi Jul 5 '09 at 10:22
@Masi - then check what's the file name - maybe it's mysld5 in your case. – pQd Jul 5 '09 at 10:23
I see the following: – Masi Jul 5 '09 at 10:25
well - ok, no mysqld then. run just sudo /opt/local/bin//mysqld_safe5 --verbose – pQd Jul 5 '09 at 10:28
@pQd: I get – Masi Jul 5 '09 at 10:32

You can manually set the owner of /opt/local/var/db/mysql5, it must be _mysql (at least in my installation)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.