On the installed MySQL server, after configuring the environment variables, found that with MySQL can not log in, reported title error, there is no way, decided to use the security mode to root user password change:
First run the command in an SSH window: Mysqld_safe--user=mysql--skip-grant-tables--skip-networking&
[Email protected] ~]# mysqld_safe--user=mysql--skip-grant-tables--skip-networking&
After running a new SSH window opens:
[[email protected] ~]# MySQL-u root MySQL
MySQL> UpdateMysql.User SetAuthentication_string=Password'MySQL')where User = 'Root'; Query OK,1Row affected,1Warning (0.02sec) Rows matched:1Changed:1Warnings:1MySQL>FlushPrivileges; Query OK,0Rows Affected (0.00sec) MySQL> ExitBye
The above is the 5.7 version of the Change Password method, the field stored in 5.7 password is no longer password, became authentication_string, before 5.7 with the following command:
MySQL>UPDATEuserSET Password=Password ('newpassword 'whereUSER='root';
Login Success After modification:
[Email protected] ~]# Mysql-uroot-Penter Password:welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connectionIDIs6Server Version:5.7.9-log MySQL Community Server (GPL) Copyright (c) -, -, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;'Or'\h' forHelp. Type'\c'ToClearThe current input statement.mysql>
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)