start MySQL server from command line on Mac OS Lion

vietstone picture vietstone · Oct 28, 2011 · Viewed 402.1k times · Source

I installed mySQL for my Mac. Beside starting the SQL server with mySQL.prefPane tool installed in System Preference, I want to know the instruction to start from command-line. I do as follow:

After

su root

I start the mySQL server by command-line, it produce error as below:

sh-3.2# /usr/local/mysql/bin/mysqld

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 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

111028 16:57:43 [ERROR] Aborting

111028 16:57:43 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

Please help me!

EDIT:

The reason is here: http://dev.mysql.com/doc/refman/5.5/en/changing-mysql-user.html

A solution is described in the xdazz's answer below.

Answer

user2792249 picture user2792249 · Sep 22, 2015

Simply:

mysql.server start

mysql.server stop

mysql.server restart