PID error on mysql.server start?

后端 未结 7 1459
名媛妹妹
名媛妹妹 2020-12-01 03:19

I\'ve just tried installing MySQL using homebrew (on Mac OS X 10.6), but I\'ve run across an issue at the first hurdle. When trying to manually start the server (mysql.serve

相关标签:
7条回答
  • 2020-12-01 03:58

    Nothing else really helped, but the following worked:

    $ ps aux | grep mysql
    tagir           27260   0.0  1.0  3562356 175120   ??  S     2:52PM   0:00.42 mysqld --skip-grant-tables
    tagir           42704   0.0  0.0  2434840    784 s000  S+    3:04PM   0:00.00 grep mysql
    $ kill 27260
    # Careful! This might erase your existing data
    $ rm -rf /usr/local/var/mysql
    $ mysqld --initialize
    $ mysql.server start
    
    0 讨论(0)
  • 2020-12-01 04:01

    I ran into this same problem when installing via homebrew. Make sure you run these commands (which are listed during install but easy to miss):

    unset TMPDIR
    mysql_install_db
    
    0 讨论(0)
  • 2020-12-01 04:04

    These following two commands should solve your issue.

    > unset TMPDIR
    > mysql_install_db --verbose --user=\`whoami\` --basedir="$(brew
    --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
    
    0 讨论(0)
  • 2020-12-01 04:06

    You probably need to ensure that you're running mysql as the root user -- otherwise it won't have permission to write the PID file (thus the error you're receiving).

    Try this:

    sudo mysql.server start
    

    You'll be prompted for your password. (this assumes that your user account has permissions to "sudo" -- which it should, unless it's setup as a restricted user account in OS X).

    This may not be the only issue -- but it should get you to the next step anyway.

    0 讨论(0)
  • 2020-12-01 04:06

    I ran into the same issue while trying to install MySQL 5.5.15 in Lion using homebrew and resolved the issue with:

    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
    

    and creating a the file ~/my.cnf

    with the content:

     [mysqld]
       basedir=/usr/local/Cellar/mysql/5.5.15
       datadir=/usr/local/var/mysql
    

    basedir - should be your current MySQL instalation dir datadir - should be the location of MySQL data

    You can figure out that too location by watching the make command during the "brew install mysql" searching for something like this:

    -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mysql/5.5.15 -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_MANDIR=/usr/local/Cellar/mysql
    

    Where DCMAKE_INSTALL_PREFIX = basedir and DMYSQL_DATADIR = datadir

    0 讨论(0)
  • 2020-12-01 04:13

    It appears that for whatever reason I can't comment below Immendes above, but on 10.8.2 with mySQL 5.6.10, in addition to verifying the db_install and adding the my.cnf, I also had to chown -R myusername /tmp/mysql.sock.

    It appears that allowing mySQL to run under the user (as apposed to root or www as I woudl do on linux) is not the best idea in this regard (though Homebrew could update the formula -- beyond my scope and time).

    0 讨论(0)
提交回复
热议问题