Install and configure MySQL under Mac

step:

1. Download the mysql installation package mysql-5.7.13-osx10.11-x86_64.bmg from the official website and install it

2. After the installation is complete, type in the terminal:

mysql --version

----The display version number is normal. If the command not found is displayed, enter the following in the terminal. "/usr/local/mysql/bin/mysql" is the default installation path of mysql:

$ cd /usr/local/bin/

$ sudo ln -fs /usr/local/mysql/bin/mysql mysql

3. Close the mysql service:

sudo /usr/local/mysql/support-files/mysql.server stop

4. Configure the password of the root account, which is not configured by default.

----- Enter in the terminal (start mysql in safe mode):

sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

-----Modify the password, input in the terminal (input line by line, must, "****" is the set password):

mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD('*****') WHERE User='root';
FLUSH PRIVILEGES;
\q

5. Verify after the configuration is complete, and enter in the terminal:

mysql -u root -p

---- Prompt to enter a password, enter mysql indicates success!

mysql>

6. The startup and shutdown of the mysql service can be operated in the system preferences. The terminal commands are as follows:

$ sudo /usr/local/mysql/support-files/mysql.server start
$ sudo /usr/local/mysql/support-files/mysql.server stop

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326349895&siteId=291194637