Solve the problem of using root to log on to mysql under ubuntu7.10

Source: Internet
Author: User
I have installed Ubuntu7.10 Server Edition and desktop edition. The server version directly configures the LAMP server and the desktop version. I use the new software Manager-edit-to use the Task Group tag software package. Select LAMP for installation. In bash, the following error is returned when you use root to log on to mysql; # mysql-uroot-p. ERROR1045 (28000): Accessdeniedforuser 'root' @ 'localhost'

I have installed Ubuntu7.10 Server Edition and desktop edition. The server version directly configures the LAMP server and the desktop version. I use the new software Manager-edit-to use the Task Group tag software package. Select LAMP for installation.

In bash, the following ERROR is returned when you use root to log on to mysql; # mysql-u root-p: ERROR 1045 (28000 ): access denied for user 'root' @ 'localhost' (using password: yes ).

What should I do?

The solution is as follows:

1. Open the/etc/mysql/debian. cnf file and use gedit on the desktop. Use vim on the server to record the username and password provided in the [client] section in the file:

Mysql-u debian-sys-maint-p

Enter password: <Enter the password for the [client] section>

Mysql> use mysql;

Mysql> UPDATE user SET Password = PASSWORD ('newpwd') where User = 'root ';

Mysql> quit

'Newpwd' is the new root password.

Log on to the root account again.

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.