(Please refer to the original article link: http://www.davenkin.me/post/2012-10-14/40039006163)
Installing MySQL in MacBook Pro is not difficult. Download the DMG file and double-click it. Note the following points:
(2) The installer will also create a symbolic link/usr/local/mysql-VERSION for/usr/local/mysql to facilitate reference in the command line. For example, you can add/usr/local/mysql/bin to the environment variable.
(3) After installation, the root user's account is user = root, password = "". You can run mysql-u root in the command line to enter MySQL.
(4) because the root user does not have a password by default, we can add or modify the password for the root user in the following ways: $ mysqladmin-u root password your-new-password, here, your-new-password is your new password.
(5) After installing the mysql-VERSION.pkg, you can also install MySQL. prefPane, double-click this file. In this way, MySQL can be started in the System Preferences of the Mac System through GUI.
(6) the root user is mainly used to manage MySQL itself. Your own application should create a new user and log on as the root user. The syntax for creating a new user is as follows:
Create user user [identified by [PASSWORD] 'Password']
For example, create a user name davenkin with a password of 12345:
Create user 'davenkin '@ 'localhost' identified by '201312 ';
(7) the permissions for newly created users are very low. In this case, we need to grant permissions to the newly created users:
Grant all privileges to mydb. * TO 'davenkin '@ 'localhost' with grant option;
The above GRANT statement opens all permissions for davenkin on the mydb database. In this case, MYDB may not be stored and will be created after logging on to davenkin.