Mac install MySQL 5.7.13 Version Login and password change

Source: Internet
Author: User

Small white users, the first installation of 5.7.13, just beginning some Mongolian, change the password is a hole, fortunately or solved, record a journey:

Installation process is very simple, directly to the official MySQL DMG, the next step can be installed. Ps:

Before the installation is complete there will be a prompt to generate a root temporary password, which should be remembered (this figure is borrowed online):

Mysql-uroot-p Use the temporary password to log in.

k$ Mysql-u Root-p

Enter Password:

Welcome to the MySQL Monitor. Commands End With; or \g.

After the successful login, hit a command to see it, the result is tragic:

mysql> show databases;

ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.

On the internet a variety of search and change the password problem, the results of the tangle of the majority of days have not changed, because there is a file written ambiguous, it may be due to the wrong version, (or I will not search +_+) So this is why I write down.

In fact, the solution is very simple, three steps to fix:

1:  mysql> SET PASSWORD = PASSWORD (' abcd_1234 '); #括号里密码是你要设置的密码

Query OK, 0 rows affected, 1 Warning (0.00 sec)

2:mysql> ALTER USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;

Query OK, 0 rows Affected (0.00 sec)

3: mysql> flush Privileges;

Query OK, 0 rows Affected (0.00 sec)

Re-open a terminal, login with the new password:

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| Information_schema |

| MySQL |

| Performance_schema |

| SYS |

+--------------------+

4 rows in Set (0.01 sec)

Mac install MySQL 5.7.13 Version login and password change

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.