After MySql is newly installed, the root account prompts mysql ERROR 1045 (28000): Access denied for use. The solution is 28000 denied.

Source: Internet
Author: User

After MySql is newly installed, the root account prompts mysql ERROR 1045 (28000): Access denied for use. The solution is 28000 denied.

After MySQL is newly installed, it is executed for the first time.mysql -uroot -pThe root password is not empty. to reset the root password, follow these steps.

Edit mysql configuration file my. ini (if my_default.ini is used, rename it my. ini) and add

 skip-grant-tables

After saving and exiting, restart mysql and click "start"-> "run" (shortcut: Win + R ).

1. stop: Enter net stop mysql

2. start: Enter net start mysql

In this case, enter mysql-u root-p in cmd to log on without a password. When password: is displayed, press enter to enter without ERROR 1045 (28000 ), however, many operations are restricted because we cannot grant (no permission ). Follow the steps below:

1. Enter the mysql database:

mysql> use mysql;Database changed

2. Set a new password for the root user. In the blue section, enter the new password:

Mysql> update user setauthentication_string = password ("new password") where user = "root"; Query OK, 1 rows affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0

3. Refresh the database

mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)

4. Exit mysql:

mysql> quitBye

After modification, modify the my. ini file, delete the "skip-grant-tables" line we just added, save and quit, and restart mysql.

You will be prompted after you log on again

ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo re executing this statement.

Just enterSet password = password ('new password ');You can.

The above is a small Editor to introduce you to the new installation of MySql, login to the root account prompt mysql ERROR 1045 (28000): Access denied for use solution, I hope to help you, if you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!

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.