如何在 Mac OS Lion 上从命令行启动 MySQL 服务器? [英] How to start MySQL server from command line on Mac OS Lion?
问题描述
我在 Mac 上安装了 mySQL.除了使用安装在系统偏好设置中的 mySQL.prefPane 工具启动 SQL 服务器之外,我想知道从命令行启动的说明.我这样做:
I installed mySQL on my Mac. Beside starting the SQL server with mySQL.prefPane tool installed in System Preferences, I want to know the instructions to start from command-line. I do as follows:
之后
su 根
我通过命令行启动 mySQL 服务器,但它产生如下错误:
I start the mySQL server by command-line, but it produces an error as below:
sh-3.2#/usr/local/mysql/bin/mysqld
sh-3.2# /usr/local/mysql/bin/mysqld
111028 16:57:43 [警告] 设置lower_case_table_names=2 因为/usr/local/mysql-5.5.17-osx10.6-x86_64/data/的文件系统是 case不敏感
111028 16:57:43 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.5.17-osx10.6-x86_64/data/ is case insensitive
111028 16:57:43 [错误] 致命错误:请阅读安全"部分了解如何以 root 身份运行 mysqld 的手册!
111028 16:57:43 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
111028 16:57:43 [错误] 中止
111028 16:57:43 [注意]/usr/local/mysql/bin/mysqld:关闭完成
111028 16:57:43 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
推荐答案
试试/usr/local/mysql/bin/mysqld_safe
示例:
shell> sudo /usr/local/mysql/bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
shell> bg
(Press Control-D or enter "exit" to exit the shell)
您也可以将这些添加到您的 bash 启动脚本中:
You can also add these to your bash startup scripts:
export MYSQL_HOME=/usr/local/mysql
alias start_mysql='sudo $MYSQL_HOME/bin/mysqld_safe &'
alias stop_mysql='sudo $MYSQL_HOME/bin/mysqladmin shutdown'
这篇关于如何在 Mac OS Lion 上从命令行启动 MySQL 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!