MySQL connection problem fix

Source: Internet
Author: User

After MySQL is installed, there is a default root user, and the password is blank. However, I cannot log on to the terminal. When I use root to log on to MySQL, # sudo MySQL
-U root-P returns the following error: Error 1045 (28000): Access denied for user
'Root' @ 'localhost' (using password: Yes ).

 

Fix:

 

On the terminal, enter sudo gedit/etc/MySQL/Debian. CNF. The following content should be displayed:

# Automatically generated for Debian scripts. Do not touch!

[Client]

Host = localhost

User = Debian-sys-Maint

Password = 123456 (I wrote the password here)

Socket =/var/run/mysqld. Sock

[Mysql_upgrade]

User = Debian-sys-Maint

Password = 123456

Socket =/var/run/mysqld. Sock

Basedir =/usr

After finding this, open the terminal and enter: sudo mysql-u Debian-sys-Maint-P

Then you will be asked to enter the password, enter the password in your file (after the password), and then you can enter.

For MySQL administrator
Enter localhost In the hostname option, enter the user name Debian-sys-Maint in your file in username, and then copy the password to it,
You can log on. As for the root user, you can change the password of the root user after entering the graphic interface.

 

 

If you use PMA (phpMyAdmin) to manage MySQL, the added account and password should also be.

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.