Mysql startup prompt accessdeniedforuserroot @ localhost (usingpa

Source: Internet
Author: User
This article introduces the solution to the mysql startup prompt accessdeniedforuserroot @ localhost (usingpassword: YES). For more information, see this article.

This article introduces the solution to the mysql startup prompt "access denied for user root @ localhost (using password: YES)". for more information, see this article.

The key is: Access denied for user 'root' @ 'localhost' (using password: YES )'

From the error, we can see that your permission is not granted to access localhost.
You can use the following command to release the permission:

Solution

1. log on to the system as an administrator, stop the mysql service, or end the mysqld-nt process;

2. go to the command line and go to the mysql installation directory. assume that the installation directory is d: mysql, and CMD enter the command line;

3. run D: Program FilesMySQLMySQL Server 5.5binmysqld-nt -- skip-grant-tables to start mysql and disable permission check;

4. run D: Program FilesMySQLMySQL Server 5.5 binmysqladmin-u root flush-privileges password "newpassword" to reset the root password;

5. restart the mysql service;

Command-based solution

Method 1:

The code is as follows:

#/Data/mysql/bin/mysqladmin-u-p <首先要停止你之前的启动的mysql.如果停止的时候.也出现1045的错误的话那只有kill掉mysql的pid>
# Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
# Mysql-u root mysql
Mysql> UPDATE user SET Password = PASSWORD ('newpassword') where USER = 'root ';
Mysql> flush privileges;
Mysql> quit

#/Etc/init. d/mysql restart
# Mysql-uroot-p
Enter password: <输入新设的密码newpassword>

Mysql>

Solution 2

First, it is included in the mysql client command line.

Then

The code is as follows:

Grant all privileges on *. * to 'root' @ 'localhost' identified by 'Your password' with grant option;

Flush privileges;

After the two commands are executed, you can

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.