mysqld_safe命令启动然后停止OSX Lion

时间:2012-03-27 12:59:50

标签: mysql osx-lion

我在OSX Lion上运行mysql 5.5.22。我的问题是mysqld_safe启动并在起始位置停止,就像这样。

我输入了以下命令: mysqld_safe

120327 05:33:57 mysqld_safe Logging to '/usr/local/mysql/data/The-BatMobile.local.err'.
120327 05:33:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

mysqld_safe程序在最后一行代码中停顿了25分钟。有人有想法吗?我完成的谷歌搜索显示了Lion的一些问题,但在这个特定问题上没有任何问题。

编辑//

在阅读了mysql错误日志后,我发现mysqldsafe可能已经在运行了前一行代码:

120327 05:33:57 mysqld_safe Logging to '/usr/local/mysql/data/The-BatMobile.local.err'.
120327 05:33:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

我的假设是否正确?

以下是错误日志:

21 120327 11:21:58 mysqld_safe mysqld from pid file /usr/local/mysql/data/the-      batmobile.pid ended
22 120327 11:23:06 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
23 120327 11:23:06 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
24 120327 11:23:06 [Note] Plugin 'FEDERATED' is disabled.
25 120327 11:23:06 InnoDB: The InnoDB memory heap is disabled
26 120327 11:23:06 InnoDB: Mutexes and rw_locks use GCC atomic builtins
27 120327 11:23:06 InnoDB: Compressed tables use zlib 1.2.3
28 120327 11:23:06 InnoDB: Initializing buffer pool, size = 128.0M
29 120327 11:23:06 InnoDB: Completed initialization of buffer pool
30 120327 11:23:06 InnoDB: highest supported file format is Barracuda.
31 120327 11:23:06  InnoDB: Waiting for the background threads to start
32 120327 11:23:07 InnoDB: 1.1.8 started; log sequence number 1595675
33 120327 11:23:07 [Note] Event Scheduler: Loaded 0 events
34 120327 11:23:07 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
35 Version: '5.5.22'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server (GPL)

2 个答案:

答案 0 :(得分:4)

我想我找到了自己问题的答案!

当执行命令mysqld_safe并且在'使用/ usr / local / mysql / data中的dbs启动守护进程'之后没有其他行弹出时,它正在工作!

120327 05:33:57 mysqld_safe Logging to '/usr/local/mysql/data/The-BatMobile.local.err'.
120327 05:33:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

我做了两次测试来证实这一点:

测试1: mysqld_safe off

我杀死了mysqld_safe进程并尝试使用“mysql -u root -p”登录,它给了我这个错误。

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2):

测试2: mysqld_safe:on

有效!我用“mysql -u root -p”登录,弹出了mysql终端!

答案 1 :(得分:2)

你的回答是正确的 - 这就是mysqld_safe的样子。很高兴你在疯狂之前弄明白了!

要停止mysql而不必手动终止它,可以使用sudo mysqladmin shutdown

要在没有无用术语窗口的情况下启动mysql,可以使用sudo mysqld_safe &这会导致mysqld在后台运行,您仍然可以使用术语窗口。但是,如果你关闭窗口它也会杀死mysqld。

能够通过运行nohup sudo mysqld_safe &使窗口关闭时能够使mysqld免于死亡,但这对我不起作用(它在后台启动,但仍然死亡)当窗户关闭时)。不知道为什么。