ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

Source: Internet
Author: User

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)

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.