Installing MySQL 5.7 under Mac OS

Source: Internet
Author: User

Mac OS X under TAR. GZ mode installing MySQL 5.7 compared to MySQL 5.6, the 5.7 version was installed in two different places:

1: Initialization mode change, from scripts/mysql_install_db--user=mysql initialization mode to bin/mysqld--initialize--user=mysql mode;

2: Initial password generation change, 5.6 version after the tar gz mode is initialized, the default root password is empty, and the 5.7 version will generate a temporary root password after initialization is completed;

Download the latest MySQL compression version, the official website to find http://dev.mysql.com/downloads/

Take 5.7.16 as an example Mysql-5.7.16-osx10.11-x86_64.tar

First double-click Unzip, extract a folder into the folder there are still 2 compressed packets, one for Mysql-5.7.16-osx10.11-x86_64.tar another for mysql-test-5.7.16-osx10.11-x86_ 64.tar

After extracting the Mysql-5.7.16-osx10.11-x86_64.tar, omit the file containing test

After unpacking, open the command line

# Move the unpacked binary package to the installation directory sudo mv Mysql-5.7.16-osx10.11-x86_64/usr/local/mysql

# change the MySQL installation directory to the user and user group cd/usr/local sudo chown-r root:wheel mysql

# switch to the MySQL installation directory and execute the init command and log the generated temporary root password cd/usr/local/mysql sudo bin/mysqld--initialize--user=mysql

Note: You need to record the temporary root password that appears in the Command line window after initialization is complete.

Test start, restart, and stop: cd/usr/local/mysql

# start sudo support-files/mysql.server start

# Restart sudo support-files/mysql.server restart

# Stop sudo support-files/mysql.server stop

# check MySQL running status sudo support-files/mysql.server status

(Warm reminder: There are two ways to operate the MySQL command, one is to set the MySQL environment variable, so you can use the MySQL command directly without the need to enter mysql/.) Executed under the/bin directory.

The other is to go directly into the/usr/local/mysql/bin/to execute the script, where the first method is used)?

In terminal, add MySQL Bin directory for path path: path= "$PATH":/usr/local/mysql/bin

Then log in to MySQL with the following command (the password is the temporary password that was automatically generated earlier) Mysql-u root-p

Enter the temporary password to log in successfully.

Recommended password change after successful login

Mysql> set PASSWORD =password (' 123456 ');

After the modification is successful, exit

Mysql> exit;

Re-connect

Mysql> Mysql-u Root-p

Enter the new password and the connection is successful.

View Database

mysql> show databases;

Installing MySQL 5.7 under Mac OS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.