1

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
    Password:
    Starting mysqld daemon with databases from /opt/local/var/db/mysql5
    STOPPING server from pid file /opt/local/var/db/mysql5/eMY-IP-ADDRESS.elisa-laajakaista.fi.pid
    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?

6 Answers6

3

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.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
2

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

radius
  • 9,633
  • 25
  • 45
  • 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. – Léo Léopold Hertz 준영 Jul 04 '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 05 '09 at 12:43
2

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
Dave Cheney
  • 18,567
  • 8
  • 49
  • 56
  • I get the following warnings in running the commands: http://dpaste.com/63345/ – Léo Léopold Hertz 준영 Jul 05 '09 at 09: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 06 '09 at 04:16
1

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.

samt
  • 713
  • 4
  • 10
  • @samt: What do you mean by "sudo settings"? --- Which variables do you mean at environment settings? – Léo Léopold Hertz 준영 Jul 04 '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. – Léo Léopold Hertz 준영 Jul 04 '09 at 21:54
  • 1
    chown should be available at /usr/sbin/chown unless something has modified your installation of OS X. – Chealion Jul 05 '09 at 05:50
  • 1
    @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, www.sudo.ws for online manual pages/samples. – samt Jul 05 '09 at 08:35
  • 1
    I did not have /usr/sbin/ in my PATH. Thank you for pointing that out! – Léo Léopold Hertz 준영 Jul 05 '09 at 09:09
  • Please, see my edit in my question. --- MySQL for some reason shuts down. – Léo Léopold Hertz 준영 Jul 05 '09 at 09:41
  • I finally get MySQL working by running MySQL at `/usr/local/mysql/bin/mysql`. It seems that this MySQL is the one installed by MySQL installer such that the settings are correct by default. --- Thank you for your answers! – Léo Léopold Hertz 준영 Jul 12 '09 at 20:09
1

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.

pQd
  • 29,981
  • 6
  • 66
  • 109
0

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