CentOS Installation MySQL Problem summary

Source: Internet
Author: User

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

Description: Just installed MySQL, the first time landing.

[[email protected] ~]$ mysql-u root-1045 (28000for'root' @ 'localhost'for'root'@' localhost ' (using Password:no)

Then I will try to modify the root password of MySQL directly:

123456'localhost ' ' root ' @ 'localhost'  (using Password:yes)'

The question is what I didn't figure out, the solution is as follows:

[Email protected] ~~]# mysqld_safe--user=mysql--skip-grant-tables--skip-networking & ~]$ MySQL-u root mysqlmysql > UPDATE user SET password=password (' NewPassword ') where user=' root '; #newpasswo Rd for root new password MySQL> FLUSH privileges;mysql>~~]$ mysql-u root-penter password : #输入新密码, OK
You must SET PASSWORD before executing this statement

Description: Use Safe mode to login successfully, then change password, equal to MySQL set password. After logging in, you want to create a database test. The result is:

1820 (HY000): Must SET PASSWORD before executing this statement

Workaround:

mysql>1820  (HY000): Must set PASSWORD before executing this statementmysql> set PASS WORD = PASSWORD ('123456'0 rows affected (0.03  sec) MySQL >1 row affected (0.00 sec)

I don't know why I set the password again.

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.