Log in error after MySQL installation is complete

Source: Internet
Author: User

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

Solve:

1, first stop the MySQL service, the command is as follows:

#/etc/init.d/mysql stop

2, restart the service, the command is as follows:

#/etc/init.d/mysql Stop
# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &

3. Log in to MySQL and change Password: command and SQL are as follows:

# mysql-u Root MySQL

mysql> Update user Set Password=password (' New password ') where user= ' root ';

mysql> flush Privileges;

mysql>commit;

mysql>quit;

#/etc/init.d/mysql Stop

#/etc/init.d/mysql Start

4, check whether the MySQL background process started, the command is as follows:

#/etc/init.d/mysql status

#mysql-uroot-p

Enter password:< password for new settings >

5. View data information:

Mysql>show databases;

If you report the following error:

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

Please execute the following command:

Mysql>set password=password (' New password ');

Re-execution:

Mysql>show databases;

All right, OK!

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.