我在我的Mac上安装了mySQL。除了用mySQL启动SQL服务器。安装在系统首选项中的prepane工具,我想知道从命令行开始的指令。 我的做法如下:

他的root

我通过命令行启动mySQL服务器,但它产生一个错误如下:

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 [ERROR]致命错误:请阅读“安全”部分 如何以root用户运行mysqld ! 111028 16:57:43 [ERROR]中止 111028 16:57:43[注]/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启动脚本:

export MYSQL_HOME=/usr/local/mysql
alias start_mysql='sudo $MYSQL_HOME/bin/mysqld_safe &'
alias stop_mysql='sudo $MYSQL_HOME/bin/mysqladmin shutdown'

其他回答

如果你用自制程序安装它,二进制文件会是

/usr/local/Cellar/mysql/5.6.10/bin/mysqld

也就是说你可以开始了

/usr/local/Cellar/mysql/5.6.10/support-files/mysql.server start

然后用

/usr/local/Cellar/mysql/5.6.10/support-files/mysql.server stop

编辑:正如Jacob Raccuia提到的,确保在路径中放入了合适的MySQL版本。

尝试/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启动脚本:

export MYSQL_HOME=/usr/local/mysql
alias start_mysql='sudo $MYSQL_HOME/bin/mysqld_safe &'
alias stop_mysql='sudo $MYSQL_HOME/bin/mysqladmin shutdown'
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

在.bash_profile中创建别名

alias start_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM start"
alias stop_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM stop"

如果您试图以根用户身份运行,请使用安全模式

sudo ./bin/mysqld_safe

如果你仍然有问题启动,建议阅读: Mysql5.58在MAC OS 10.6.5中启动服务器

111028 16:57:43 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

你为你的mysql安装设置root密码了吗?这与您的sudo根密码不同。尝试/usr/local/mysql/bin/mysql_secure_installation

我也喜欢这些别名……然而,我有MySQLCOM的问题开始…它默默地失败了……我的解决办法和其他人的类似。~ / .bash_aliases

alias mysqlstart='sudo /usr/local/mysql/support-files/mysql.server start'
alias mysqlstop='sudo /usr/local/mysql/support-files/mysql.server stop'