Project experience sharing--perfect solution access denied for user ' root ' @ ' localhost ' (using Password:yes)

Source: Internet
Author: User
This question haunts me for a few hours to see the problem.

Summary sentence: Permission issues. How do you authorize that?
First step: Stop service
Command line:
/etc/init.d/mysql stop
If not, execute the next line:
Service Mysqld Stop
Stopping mysqld: [OK]

Step Two: Skip password verification
To execute a command line:
151104 09:07:56 mysqld_safe Logging to '/var/lib/mysql/iz23dq2wm0jz.err '.
151104 09:07:56 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql

Step three: no password login
To execute a command line:
Mysql-u Root

Fourth step: Authorize
mysql>Grant all privileges in *.* to ' root ' @ ' localhost ' identified by ' root ' with GRANT option;
Keyword Explanation:
Root ' @ ' localhost: is a user
Root: Is the password

Problem one: No password conditions, no authorization to write permission
The MySQL server is running with the--skip-grant-tables option so it cannot execute this statement
Mysql> Set global read_only=0;//(turn off the read-only property of the new home library)
Mysql>flush privileges;

Mysql>set Global read_only=1;//(read-write properties)
mysql>flush privileges; strong> (note refresh is mandatory)

Step Fifth: Restart the database
Service mysqld Stop
stopping mysqld:  [  ok ]

Service mysqld start
starting mysqld:  [  ok ]
service mysqld restart

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: 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.