views:

752

answers:

6

I just erased and re-installed Snow Leopard. I installed MySQL 5.1.48 64-bit clean. I'm having issues with the MySQL server... when I boot the computer and log in, the server is not running. I tried to start it using the preference pane by clicking "Start MySQL Server", but all it did was highlight the button blue and think for like a minute, and then the button went back to normal and nothing happened.

I then tried starting it from the terminal:

Hristo$ sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
.....................................................................
ERROR! Manager of pid-file quit without updating file.

so I checked the status:

Hristo$ sudo /usr/local/mysql/support-files/mysql.server status
Password:
/usr/local/mysql/support-files/mysql.server: line 418: pidof: command not found
 ERROR! MySQL is not running

I tried this:

Hristo$ /usr/local/mysql/bin/mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

So I'm not sure what to do. When I first installed, the server was working but I went to the preference pane to try and stop it… and the same thing happened… I clicked the "Stop MysQL Server" button, it did some thinking, then nothing. So I restarted the computer and now I'm having the above problems and apparently, the mysql.sock file is not in /tmp/ anymore. It was there when I installed, and it is not there after I restarted the computer.

Any ideas?

UPDATE 3: mysql.err:

100706 11:38:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
100706 11:38:36 [Warning] '--log' is deprecated and will be removed in a future release. Please use ''--general_log'/'--general_log_file'' instead.
100706 11:38:36 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead.
100706 11:38:36 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
100706 11:38:36 [Note] Plugin 'FEDERATED' is disabled.
100706 11:38:36  InnoDB: Started; log sequence number 0 69987
100706 11:38:36 [ERROR] Can't start server : Bind on unix socket: Permission denied
100706 11:38:36 [ERROR] Do you already have another mysqld server running on socket: /var/mysql/mysql.sock ?
100706 11:38:36 [ERROR] Aborting

100706 11:38:36  InnoDB: Starting shutdown...
100706 11:38:41  InnoDB: Shutdown completed; log sequence number 0 69987
100706 11:38:41 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

mysql.log:

/usr/local/mysql/bin/mysqld, Version: 5.1.46-log (MySQL Community Server (GPL)). started with:
Tcp port: 0  Unix socket: /var/mysql/mysql.sock
Time                 Id Command    Argument

UPDATE 2: When setting up Apache, PHP, and MySQL, I followed these instructions: http://superfancy.net/coding/php-mysql-apache-in-mac-osx-leopard/ Right now, if I remove the MySQL configuration file, things seem to work fine. But when my.cnf exists in /etc/, things don't work. The MySQL verion is:

Hristo$ mysql --version
/usr/local/mysql/bin/mysql  Ver 14.14 Distrib 5.1.46, for apple-darwin9.8.0 (i386) using readline 5.1

UPDATE: This is my /etc/my.cnf file.

[client]
socket = /var/mysql/mysql.sock

[mysqld]
socket = /var/mysql/mysql.sock

Thanks, Hristo

btw... I apologize for posting this question on Stack Overflow... no one is responding on Server Fault :/

+1  A: 

The file is supposed to be recreated every time that MySQL is loaded, but sometimes permissions will get in the way. Try manually creating /tmp/mysql.sock

On linux the command would be:

sudo touch /tmp/mysqld.sock

Then set the correct owner: sudo chown mysql:mysql /tmp/mysqld.sock

I assume command line on a mac would be the same.

Aaron Harun
Yes, the commands are the same. However, this didn't work. I restarted and the file was gone again. I re-touch'd it, re-chown'd, and then tried starting MySQL... then the file was gone again.
Hristo
Make sure your myqsl config file is still valid after the reinstall.
Aaron Harun
@Aaron... I'm sorry, but what do you mean by valid?
Hristo
Just make sure that none of the directories or paths have changed. I've done that a few times.
Aaron Harun
Everything seems good in the config file
Hristo
+1  A: 

There seems to be an error message:

line 418: pidof: command not found

Do you have pidof installed? Its manpage says:

pidof is simply a (symbolic) link to the killall5 program, which should also be located in /sbin

Perhaps the symlink doesn't exist or killall5 is not installed on your Mac OS?

Piskvor
There is no manual entry for `pidof`... `Hristo$ man pidof No manual entry for pidof`. Also, there is a `killall` in `/usr/bin` but not in `/usr/sbin`
Hristo
Try `which pidof` - if you don't get anything, this can be the reason. I don't know how killall5 is (dis)similar to killall and whether it can be used interchangeably...
Piskvor
`which pidof` returns nothing. I'll look into what it is and how to install it. Any suggestions?
Hristo
On my Linux system, it seems to be in a package `sysvinit-utils`: /bin/pidof ; see if you have a similar package (not sure if it's available in Mac OS, but I'd think it should be).
Piskvor
no there isn't a `pidof` anywhere on my system
Hristo
Hm, I'm not sure how OS X installation works, but this seems to be the thing you're looking for: http://osx.iusethis.com/app/pidof
Piskvor
Ok... I installed the `pidof` utility and the error `/usr/local/mysql/support-files/mysql.server: line 418: pidof: command not found` doesn't show up anymore. But the server still doesn't work... after I restart, I can't start the server... still getting `ERROR! Manager of pid-file quit without updating file.`
Hristo
... need to find the killall5 program...
Hristo
`pidof` isn't the problem. The `mysql.server` script is just calling that to find the pid of the MySQL process.
Dan Loewenherz
A: 

http://dev.mysql.com/doc/refman/5.5/en/mysql-server.html

Quoting David Tonhofer:

And also add
-----------
echo "Manager PID file is $pid_file, Server PID file is $server_pid_file"
-----------
directly before the line 'case "$mode" in'
for some great debugging justice.

My initial guess was that the mysqld doesn't have permission to update / delete its pidfile, and probably there is a left-over pidfile that needs to be removed by hand. But "great debugging justice" sounds too good to miss. :)

sarnold
A: 

Try to install it as a part of MAMP . That will install a mysql server in a different location ( Applications/MAMP/mysql along with apache etc. Then you can just use the widget to start it. You can also monitor the activity with the acitivity monitor (Applications/utilities) . Besides:

Deleting: /Applications/MAMP/tmp/mysql/mysql.pid

and restarting does help often.

HTH

ran2
+1  A: 

I think there is an error somewhere in your my.cnf file.

Try to take one of the stock my.cnf files or add options for user, pid-file, port, basedir, datadir, tmpdir under [mysqld] section (here's a quote of basic mysqld settings on linux machine, for OS X maybe this will help)

[mysqld]
#
# * Basic Settings
#

user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
skip-external-locking

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address        = 127.0.0.1
Unreason
The reason I have the my.cnf file the way it is posted above is because of the instructions I followed here: http://superfancy.net/coding/php-mysql-apache-in-mac-osx-leopard/ When I was setting up MySQL, I followed the instructions under the **"Getting MySQL and PHP to communicate"** section. Any suggestions on the `socket` settings for the default config file?
Hristo
you said that the server starts if you don't use my.cnf file; in that case start it like that and then run `mysql --help` to get info on which actual cnf file is used and what are the values of various variables that are set from it. You can take the value of `socket` from here.
Unreason
+2  A: 

Install homebrew package manager with the quick install method http://github.com/mxcl/homebrew

Then from terminal

brew install mysql

and follow the short list of directions that follow the installation

to see the instructions again

brew info mysql

Jed Schneider
brew info was helpful - thanks!
shedd
No problem. Its one of the nicest features of os x :)
Jed Schneider