First, in the Mac, MySQL installed, in order to use MySQL to start the MySQL service, then how to start by the terminal command line form? Here are 2 ways to do it:
1.mysql Service Start/stop command: Sudo/usr/local/mysql/support-files/mysql.server start (stop)
2.sudo/library/startupitems/mysqlcom/mysqlcom [Start | stop | restart]
Second, since the service has been started, so quickly into the MySQL it? This sets the environment variables first:
Command: Alias Mysql=/usr/local/mysql/bin/mysql
Now you can directly enter the MYSQL-U user name-P into MySQL, if prompted-bash:mysqladmin:command not found, then add the following command can be
Command: Alias Mysqladmin/usr/local/mysql/bin/mysqladmin
The above environment variable is temporary, in order to permanently valid only through the configuration file, modify the home directory of the ~/.bash_profile file, do not create one, and then write to the above command content can be, or write/ETC/BASHRC This file can also, Finally, restart the terminal or open a new window.
Third, how to create a password for the root user? You can use the following command:
/usr/local/mysql/bin/mysqladmin-u Root Password root
Use of Mac MySQL