Bug #42673 sudo /Library/StartupItems/MySQLCOM/MySQLCOM start does nothing
Submitted: 7 Feb 2009 19:26 Modified: 16 Feb 2009 6:48
Reporter: Jacques PIOTROWSKI Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.30 OS:MacOS (x86, PKG format)
Assigned to: CPU Architecture:Any
Tags: sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

[7 Feb 2009 19:26] Jacques PIOTROWSKI
Description:
Hello (from France),

I have installed MySQL 5.1.30 for MAC OS X 10.5 in the package format and "MySQLStartupItem".

The following command line does nothing at all :

"sudo /Library/StartupItems/MySQLCOM/MySQLCOM start"

I must use the "restart" parameter to (re)start the server...

There is no error or warning message(s).

The command line "sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop" works well.

How to repeat:
You can repeat this with exactly the same command...

Suggested fix:
I have no idea...
[9 Feb 2009 10:27] Sveta Smirnova
Thank you for the report.

Do you have custom .my.cnf file in your home directory? What "sudo /usr/local/mysql/support-files/mysql.server start" outputs?
[9 Feb 2009 16:50] Jacques PIOTROWSKI
Hello,

here my replies to 2 questions :

1) Do you have custom .my.cnf file in your home directory? 
Reply : no, there is no ".my.cnf" file in my home directory.

2) What "sudo
/usr/local/mysql/support-files/mysql.server start" outputs? 
Reply : absolutely nothing.

But the following works well :

sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart (but "start" does nothing at all)

usr/local/mysql/bin/mysql -u root -p

use mysql

Grant (user) and Create database

sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
[9 Feb 2009 17:36] Sveta Smirnova
Thank you for the feedback.

Please apply to /usr/local/mysql/support-files/mysql.server patch following:

--- /usr/local/mysql/support-files/mysql.server 2009-02-09 13:25:28.000000000 +0300
+++ /usr/local/mysql/support-files/mysql.server.new     2009-02-09 20:34:03.000000000 +0300
@@ -173,7 +173,7 @@
 
     # if manager isn't running, then pid-file will never be updated
     if test -n "$manager_pid"; then
-      if kill -0 "$manager_pid" 2>/dev/null; then
+      if kill -0 "$manager_pid" ; then
         :  # the manager still runs
       else
         # The manager may have exited between the last pid-file check and now.  
@@ -313,7 +313,7 @@
       "$manager" \
         --mysqld-safe-compatible \
         --user="$user" \
-        --pid-file="$pid_file" >/dev/null 2>&1 &
+        --pid-file="$pid_file"  &
                echo "$manager"
       wait_for_pid created $!; return_value=$?
 
@@ -328,7 +328,7 @@
       # Give extra arguments to mysqld with the my.cnf file. This script
       # may be overwritten at next upgrade.
       pid_file=$server_pid_file
-      $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
+      $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args  &
          echo "$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args"
       wait_for_pid created $!; return_value=$?
 
@@ -401,7 +401,7 @@
     # First, check to see if pid file exists
     if test -s "$server_pid_file" ; then 
       read mysqld_pid < $server_pid_file
-      if kill -0 $mysqld_pid 2>/dev/null ; then 
+      if kill -0 $mysqld_pid  ; then 
         log_success_msg "MySQL running ($mysqld_pid)"
         exit 0
       else

Then run new /usr/local/mysql/support-files/mysql.server and provide its output
[9 Feb 2009 17:36] Sveta Smirnova
Also, please, download new version 5.1.31, try with it and inform us if problem exists with this version.
[15 Feb 2009 18:05] Jacques PIOTROWSKI
I have applyed the patch to mysqs.server script :

imac-de-xxx-xxx:~ xxxxxx$ /usr/local/mysql-5.1.30-osx10.5-x86/support-files/mysql.server start
Starting MySQL
./bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/imac-de-xxx-xxx.local.pid 
.090215 19:00:48 mysqld_safe Logging to '/usr/local/mysql/data/imac-de-xxx-xxx.local.err'.
touch: /usr/local/mysql/data/imac-de-xxx-xxx.local.err: Permission denied
chown: /usr/local/mysql/data/imac-de-xxx-xxx.local.err: Permission denied
090215 19:00:48 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
./bin/mysqld_safe: line 96: /usr/local/mysql/data/imac-de-xxx-xxx.local.err: Permission denied
rm: /usr/local/mysql/data/imac-de-xxx-xxx.local.pid: Permission denied
./bin/mysqld_safe: line 133: /usr/local/mysql/data/imac-de-xxx-xxx.local.err: Permission denied
090215 19:00:48 mysqld_safe mysqld from pid file /usr/local/mysql/data/imac-de-xxx-xxx.local.pid ended
./bin/mysqld_safe: line 96: /usr/local/mysql/data/imac-de-xxx-xxx.local.err: Permission denied
/usr/local/mysql-5.1.30-osx10.5-x86/support-files/mysql.server: line 176: kill: (206) - No such process
/usr/local/mysql-5.1.30-osx10.5-x86/support-files/mysql.server: line 176: kill: (206) - No such process
 ERROR! Manager of pid-file quit without updating file.
[16 Feb 2009 6:48] Sveta Smirnova
Thank you for the feedback.

You have many "Permission denied" errors. This means you have incorrect user rights set for the data directory. (It should be user - mysql and group - mysql if you run the command with `sudo` and your account/group without `sudo`). Please fix user permissions.

Closing the report as "Not a Bug", because you have incorrect user permissions which is not MySQL bug.