10 Replies Latest reply: Mar 6, 2012 1:30 AM by Kann
Kann Level 1 Level 1 (0 points)

A guy at work just mistakenly change the database location of our OS X 10.6.8 server via Server Admin Tools. Now the Wordpress website that is hosted on this machine stops working because MySQL is messed up. I need to change the settings back to the previous default database location before tracing all the mistakes and errors.

 

Is the database location of Mac OS X 10.6.8 the same as other Linux variants? Is it /var/mysql?

 

Would anyone check the settings in Server Admin Tools for me?

 

Thanks a bunch in advance.


Mac Pro, Mac OS X (10.6.7)
  • MrHoffman Level 6 Level 6 (13,020 points)

    The default location for MySQL data is /var/mysql on Snow Leopard Server.

     

    Make a disk backup before making additional changes here; boot the Snow Leopard Server DVD, and copy out the current configuration.  This on the off chance that the server or database configuration is more damaged than it might initially appear.

  • Kann Level 1 Level 1 (0 points)

    Thanks for your help. Now I changed the database location back to the default location, and try to run "mysqld_safe" to start the MySQL server again. However, strangly, it seems that mysqld is trying to access mysql.sock but somehow the port is not available. I checked for another mysqld instance whether there could be duplicate deamon that already used the port, but there was no additional mysqld deamon.

     

    120301 16:37:22 [Warning] Setting lower_case_table_names=2 because file system for /Library/WebServer/Sites/{my_host_name}/mysql/ is case insensitive

    InnoDB: The InnoDB memory heap has been disabled.

    InnoDB: Mutex and rw_lock use GCC atomic builtins.

    120301 16:37:22  InnoDB: Started; log sequence number 0 43655

    120301 16:37:22 [ERROR] Can't start server : Bind on unix socket: Address already in use

    120301 16:37:22 [ERROR] Do you already have another mysqld server running on socket: /var/mysql/mysql.sock ?

    120301 16:37:22 [ERROR] Aborting

     

     

    120301 16:37:22  InnoDB: Starting shutdown...

    120301 16:37:24  InnoDB: Shutdown completed; log sequence number 0 43655

    120301 16:37:24 [Note] /usr/libexec/mysqld: Shutdown complete

    Is this because some other processes are using the port 3306 that is supposed to be available for mysqld? How do I find out whether which process is using this port?

  • Kann Level 1 Level 1 (0 points)

    Another error message from "mysqld_safe"

    sh-3.2# mysqld_safe

    Starting mysqld daemon with databases from /var/mysql

    rm: /var/mysql/mysql.sock: is a directory

    STOPPING server from pid file /var/mysql/pharmacy.local.pid

    120301 16:52:42  mysqld ended

  • Kann Level 1 Level 1 (0 points)

    My mistake, the post #3 was from wrong log file. Here is the error log from the log file after I changed the database location back to /var/mysql

     

    sh-3.2# more /var/mysql/{host_name}.err

    120301 16:52:41  mysqld started

    120301 16:52:41 [Warning] Setting lower_case_table_names=2 because file system for /var/mysql/ is case insensitive

    InnoDB: The InnoDB memory heap has been disabled.

    InnoDB: Mutex and rw_lock use GCC atomic builtins.

    120301 16:52:41  InnoDB: Started; log sequence number 0 43675

    120301 16:52:41 [ERROR] Can't start server : Bind on unix socket: Address already in use

    120301 16:52:41 [ERROR] Do you already have another mysqld server running on socket: /var/mysql/mysql.sock ?

    120301 16:52:41 [ERROR] Aborting

     

     

    120301 16:52:41  InnoDB: Starting shutdown...

    120301 16:52:42  InnoDB: Shutdown completed; log sequence number 0 43675

    120301 16:52:42 [Note] /usr/libexec/mysqld: Shutdown complete

     

     

    120301 16:52:42  mysqld ended

  • MrHoffman Level 6 Level 6 (13,020 points)

    Here is some background on one of the wrinkles with the mysql.sock file on some of the 10.6 versions, and a MySQL test.

     

    Though you may have checked this, does the following show a MySQL daemon lurking somewhere:

     

    $ ps -Al | grep -i "mysqld"

     

    And FWIW, also check the php.ini file for other collateral damage here, as changes made to MySQL can also involve the php configuration file.  (Those changes won't trigger this error, but it'll trigger other ones.)

     

    The above assumes you don't have a backup made before the changes.

  • Kann Level 1 Level 1 (0 points)

    Yep, I did use ps command to search for another mysqld deamon process already. Didn't find any other mysqld at all...

     

    The documentation on MySQL's site suggests that this could also be the firewall problem. So I checked /etc/hosts, and 127.0.0.1 localhost is already there.

     

    sh-3.2# ps -Al | grep -i "mysqld"

       0 41319 41307     4006   0  31  0  2435116    464 -      S+   ffffff8019f66180 ttys001    0:00.00 grep -i mysqld

     


    Another strange thing is that, from the log file, it seems that the mysqld deamon tries to start up and shut down every few minutes. So, there are repetitive complains in the log files about mysql.sock being not available...

  • MrHoffman Level 6 Level 6 (13,020 points)

    Depending on the changes beyond the directory setting that might have been introduced here, the MySQL configuration may well be seriously messed up, and you may be headed for a roll-in from backups or a reinstallation.

     

    That grep command shows no mysqld daemon was running.

     

    Dig around over at Oracle's MySQL web site for details on the startup errors and related processing.

     

    Also see if there's a second, separate MySQL installed; I've seen that happen at a few sites.

  • Kann Level 1 Level 1 (0 points)

    If there's seperate MySQL installed, shouldn't the mysqld deamon been found from ps | grep command?

     

    I am not sure how much corrupted the MySQL configuration is now. In fact, I was the person who configured this web server few years ago, but now am on leave to pursue graduate study. Now they have this new guy who doesn't have much clue about what was going on, and he just somehow broke the system.

     

    My next strategy is to try to create a new location for the new database location, and will point MySQL configuration to this newly created location. Then I will restart the machine and see if MySQL could run from this blank database location. If not, then it seems that the problem is rather with the MySQL than the MySQL database files?

  • MrHoffman Level 6 Level 6 (13,020 points)

    Not having mysqld running does not mean there isn't a parallel MySQL installed. 

     

    If there's another mysqld around, this:

     

    $ mdfind "kMDItemDisplayName=='mysqld'"

     

    will usually find it.

     

    Why you're getting that error on that file, I don't know; it arises occasionally with MySQL, and there can be different triggers for it.  That's why I suggested the Oracle MySQL web site.

     

    Do you have database and web-facing backups?  If so, I'd consider making a disk backup of the current disk contents (for anything that was missed from the most recent backups) and then restore the box from distro and restore the databases.  

     

    Prior to that full restoration (but still after getting a full-disk backup), your idea of a different directory is quite reasonable; I might well restore a mysqldump SQL file as part of that testing.

  • Kann Level 1 Level 1 (0 points)

    I run the mdfind commmand and now the result from that is...

     

    $ /usr/libexec/mysqld

     

    Now I am trying to find more resources on MySQL website.