Opened 15 years ago
Last modified 10 years ago
#20421 new defect
mysql5-server port failed to start
Reported by: | conradwt (Conrad Taylor) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.8.0 |
Keywords: | Cc: | pixilla (Bradley Giesbrecht), nerdling (Jeremy Lavergne) | |
Port: | mysql5-server |
Description (last modified by mf2k (Frank Schima))
The mysql5-server port failed to be accessing after executing the following commands on Snow Leopard build 10A411:
- sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
- sudo -u mysql mysql_install_db5
- reboot
- mysql5 -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
Is there a missing step somewhere?
Change History (27)
comment:1 Changed 15 years ago by tobypeterson
comment:2 Changed 15 years ago by conradwt (Conrad Taylor)
This is a installation/configuration issue. I was just providing the OS information for the ticket.
comment:3 Changed 15 years ago by tobypeterson
Summary: | mysql5-server port failed to start on Snow Leopard → mysql5-server port failed to start |
---|
comment:4 Changed 15 years ago by mf2k (Frank Schima)
Description: | modified (diff) |
---|---|
Owner: | changed from macports-tickets@… to ryandesign@… |
comment:5 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Does the MySQL log file say anything interesting?
comment:6 Changed 15 years ago by conradwt (Conrad Taylor)
Where exactly are the log file for MySQL 5?
comment:7 follow-up: 8 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
It should be in /opt/local/var/log/mysql5
comment:8 Changed 15 years ago by conradwt (Conrad Taylor)
Replying to ryandesign@…:
It should be in /opt/local/var/log/mysql5
The only file that was located in the above path was empty:
.turd_mysql5-server
comment:9 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Ok, so no log file got written at all.
Are the permissions of /opt/local/var/log/mysql5 such that mysql5 can write into it? The directory should be owned by mysql:mysql, or on Leopard or later possibly _mysql:_mysql. What about the permissions of /opt/local/var and /opt/local/var/log? They should be 755.
What happens if you start safe_mysqld manually from the command line, as root or with sudo? Do you get an error message? Or does the server then start?
comment:10 Changed 15 years ago by conradwt (Conrad Taylor)
Yes, the permissions on "/opt/local/var/log/mysql5" is as follows:
drwxr-xr-x root _mysql
Also, the permissions on "/opt/local/var" is as follows:
drwxr-xr-x root admin
Next, the permissions on "/opt/local/var/log" is as follows:
drwxr-xr-x root admin
Finally, the server starts for "sudo /opt/local/lib/mysql5/bin/mysqld_safe &" but I'm seeing the same message as before when using the command line interface:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
comment:11 Changed 15 years ago by nerdling (Jeremy Lavergne)
Cc: | snc@… added |
---|---|
Keywords: | snowleopard removed |
Sounds like you have an incorrect default socket path. Have you checked /tmp for a mysql socket?
comment:12 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
If there is no log file, I doubt mysqld is even running.
Do you see any mysqld processes in Activity Monitor? Is there anything about mysqld in Console?
comment:13 Changed 15 years ago by conradwt (Conrad Taylor)
The only thing that I see when doing a 'ps ax | grep mysql' is the following:
darnoc-laptop:LaunchDaemons conradwt$ ps ax | grep mysql 203 ?? Ss 0:00.01 /opt/local/bin/daemondo --label=mysql5 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper restart ; --pid=none
Also, I'm seeing the following message is generated in the Console when I load the standard file:
$ sudo launchctl load -w /opt/local/etc/LaunchDaemons/org.macports.mysql5/org.macports.mysql5.plist' console result: 8/4/09 12:44:09 AM org.macports.mysql5[203] Starting MySQL 8/4/09 12:44:09 AM org.macports.mysql5[203] . 8/4/09 12:44:09 AM com.apple.launchd[1] (0x100116c10.anonymous.nohup[227]) Bug: launchd_core_logic.c:8245 (23928):0 8/4/09 12:44:09 AM com.apple.launchd[1] (0x100116c10.anonymous.nohup[227]) Switching sessions is not allowed in the system Mach bootstrap. 8/4/09 12:44:09 AM com.apple.launchd[1] (0x100116c10.anonymous.nohup[227]) _vprocmgr_switch_to_session(): kr = 0x44c 8/4/09 12:44:09 AM com.apple.launchd[1] (0x100116c10.anonymous.nohup[228]) Bug: launchd_core_logic.c:8245 (23928):0 8/4/09 12:44:09 AM com.apple.launchd[1] (0x100116c10.anonymous.nohup[228]) Switching sessions is not allowed in the system Mach bootstrap. 8/4/09 12:44:09 AM com.apple.launchd[1] (0x100116c10.anonymous.nohup[228]) _vprocmgr_switch_to_session(): kr = 0x44c 8/4/09 12:44:10 AM org.macports.mysql5[203] . 8/4/09 12:44:11 AM org.macports.mysql5[203] . 8/4/09 12:44:12 AM org.macports.mysql5[203] ERROR! Manager of pid-file quit without updating file. 8/4/09 12:45:23 AM com.apple.WebKit.PluginAgent[248] Debugger() was called!
Also, when I unload the above file, I'm seeing the following message in the Console:
$ sudo launchctl unload -w /opt/local/etc/LaunchDaemons/org.macports.mysql5/org.macports.mysql5.plist console result: 8/4/09 12:54:01 AM org.macports.mysql5[273] ERROR! MySQL manager or server PID file could not be found!
Lastly, there was no socket path found in '/tmp'. Also, I wasn't about to locate one on the standard path, '/opt/local/var/run/mysql5/'. I'll check my PowerMac G5 permissions for MySQL 5 and compare them to what I'm seeing on the MacBook Pro.
comment:14 Changed 15 years ago by conradwt (Conrad Taylor)
OK, it may be a permissions problem on '/opt/local/var/run/mysql5':
before: $ ls -al drwxr-xr-x 3 root _mysql 102 Jul 23 20:00 mysql5 after: $ sudo chown _mysql:admin mysql5 $ ls -al drwxr-xr-x 4 _mysql admin 136 Aug 4 01:06 mysql5
Now, I'm seeing the following when I perform a 'ps ax | grep mysql':
$ ps ax | grep mysql 393 ?? Ss 0:00.01 /opt/local/bin/daemondo --label=mysql5 --start-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper restart ; --pid=none 403 ?? S 0:00.01 /bin/sh /opt/local/lib/mysql5/bin/mysqld_safe --datadir=/opt/local/var/db/mysql5 --pid-file=/opt/local/var/db/mysql5/darnoc-laptop.local.pid 423 ?? S 0:00.21 /opt/local/libexec/mysqld --basedir=/opt/local --datadir=/opt/local/var/db/mysql5 --user=mysql --pid-file=/opt/local/var/db/mysql5/darnoc-laptop.local.pid
comment:15 Changed 15 years ago by tobypeterson
Try loading the /Library/LaunchDaemons/... path instead, I wouldn't be surprised if loading the wacky /opt/local path is what's making it get loaded into the wrong bootstrap.
comment:16 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Or simpler still, just use:
sudo port load mysql5-server
comment:17 Changed 15 years ago by greut.lists@…
I had to unload it:
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5.plist
and then could launch it using the usual:
sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start
launchctl seems to cause the trouble here…
comment:18 follow-up: 19 Changed 15 years ago by brooks-adcock
So where is the socket SUPPOSED to be? Is it in /tmp or in /opt/local/var/run/mysql5 ?
What files need to reference this? /opt/local/etc/mysql5/my.cnf? /opt/local/var/db/php5/mysql.ini? /opt/local/etc/php5/php.ini?
Did I overlook an install readme file on macports for this? If not, one would be useful because the tutorials out there describing how to execute the set for mysql from macports are horrible.
comment:19 follow-up: 20 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to enginerd1@…:
So where is the socket SUPPOSED to be? Is it in /tmp or in /opt/local/var/run/mysql5 ?
/opt/local/var/run/mysql5.
What files need to reference this? /opt/local/etc/mysql5/my.cnf? /opt/local/var/db/php5/mysql.ini? /opt/local/etc/php5/php.ini?
Do not modify any file in /opt/local/var/db/php5. Your changes will not be preserved when you upgrade the port that installed that file.
I don't know which files absolutely need to specify the socket location. When in doubt, specify it everywhere possible, including my.cnf and php.ini.
Did I overlook an install readme file on macports for this? If not, one would be useful because the tutorials out there describing how to execute the set for mysql from macports are horrible.
I can't speak for any third-party tutorials. The only one we have is the MAMP how-to. If it's inaccurate or inadequate, please let us know, or better yet, register for a Trac account and edit the page yourself.
comment:20 Changed 15 years ago by wirr@…
hello! removing "innodb_log_arch_dir = /opt/local/var/db/mysql5/" from /opt/local/etc/mysql5/my.cnf solved this problem for me.
comment:21 follow-up: 22 Changed 15 years ago by jfjhong@…
Replying to conradwt@…:
The mysql5-server port failed to be accessing after executing the following commands on Snow Leopard build 10A411:
- sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
- sudo -u mysql mysql_install_db5
- reboot
- mysql5 -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)Is there a missing step somewhere?
I had the same exact error when I tried to start MySQL server on my macbook pro running SL. Eventually i found the solution. It seems like there MySQL is looking for the socket connection in the wrong place. Go to /opt/local/etc/php5/php.ini-development and make sure that the following variables are blank
pdo_mysql.default_socket
mysql.default_socket
mysqli.default_socket =
in my case they were set to /tmp/mysql.sock . Also if you have a .cnf file make sure you are not pointing the defeault socket to the wrong location
comment:22 Changed 15 years ago by jfjhong@…
Replying to jfjhong@…:
Replying to conradwt@…:
The mysql5-server port failed to be accessing after executing the following commands on Snow Leopard build 10A411:
- sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
- sudo -u mysql mysql_install_db5
- reboot
- mysql5 -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)Is there a missing step somewhere?
I had the same exact error when I tried to start MySQL server on my macbook pro running SL. Eventually i found the solution. It seems like there MySQL is looking for the socket connection in the wrong place. Go to /opt/local/etc/php5/php.ini-development and make sure that the following variables are blank
pdo_mysql.default_socket
mysql.default_socket
mysqli.default_socket =
in my case they were set to /tmp/mysql.sock . Also if you have a .cnf file make sure you are not pointing the defeault socket to the wrong location
I forgot to mention.... after following the previous steps, try using:
/opt/local/share/mysql5/mysql/mysql.server start
it should succeed :) to double check try mysqlshow5 -p to see the databases installed in your machine
comment:23 follow-up: 24 Changed 14 years ago by oobleck@…
One more potential issue and solution:
chmod g+rx /opt/local/var/db/mysql5/mysql
It caused the server startup to fail which in turn created the same ERROR 2002.
It seems that there were several installation problems leading to this error, so if this isn't the correct place, please triage it.
comment:24 Changed 14 years ago by oobleck@…
Sorry for the bad post, I thought I'd be able to edit the post.
Just to be clear, the directory did not have group permissions, and since root was the owner, the daemon couldn't access it.
And slightly more information: I'm using 10.6.7 Server, which I think comes with MySQL, even if not through MacPorts. I also installed the mysql5 client before the server. Some combination of these things may have caused the directory to exist prior, or perhaps the install scripts went down a different path which didn't 'install' the directory correctly.
Replying to oobleck@…:
One more potential issue and solution:
chmod g+rx /opt/local/var/db/mysql5/mysql
It caused the server startup to fail which in turn created the same ERROR 2002.
It seems that there were several installation problems leading to this error, so if this isn't the correct place, please triage it.
comment:25 Changed 13 years ago by psychicpsquirrel@…
I was having a similar problem to the above, and found a fix on a blog post that worked for me. In addition to the
ERROR! MySQL manager or server PID file could not be found!
error message, I was also getting this error in the console.
18/06/11 12:07:10 AM com.apple.launchd[1] (0x10e4b0.nohup[2213]) Could not setup Mach task special port 9: (os/kern) no access
While searching for this second error message, I found this blog entry that said that the second error message was caused by a problem with the permissions on the /opt/local/var/db/mysql5/ directory. I found a couple of files that had the owner set to root:admin instead of _mysql:admin. All I did was
sudo chown -R _mysql:admin /opt/local/var/db/mysql5/
and I was able to start mysql from the command line, and with launchctl.
This might not exactly what the others here are experiencing, but it's worth a try. Here's a link to the blog post.
http://systems.takizo.com/2008/06/09/mysql5-server-cannot-start-on-apple-mac-leopard/
comment:26 Changed 13 years ago by dev@…
I experienced this problem. Something went wrong with my installation via mac ports.
I found in the error.log:
Can't start server : Bind on unix socket: Permission denied Do you already have another mysqld server running on socket: /opt/local/var/run/mysql5/mysqld.sock ?
Check if you can read/write to /opt/local/var/run/mysql5/ with user mysql:
sudo -u mysql touch /opt/local/var/run/mysql5/test sudo -u mysql ls l /opt/local/var/run/mysql5
If not so check the permissions in superior folders. In my case /opt/local/var/run had strange permissions 730 (drwx-w----) but should be 755.
comment:27 Changed 10 years ago by jmroot (Joshua Root)
Cc: | pixilla@… added |
---|
I doubt this is a SL issue.