Solve the Problem of MySQL service error in Mandriva

Source: Internet
Author: User

I have been depressed for many days. By default, the database mysql installed in mandriva is faulty. The problem is more than two connections. Let's talk about it now.

1) install mysql: sudo urpmi mysql

2) Run mysql-uroot. [mysql] ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2) solution: If the mysql daemon process is not started, execute service mysqld start.

3) Continue mysql-uroot with ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)

Solution:

#/Etc/init. d/mysql stop
# Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
# Mysql-u root mysql
Mysql> UPDATE user SET Password = PASSWORD ('newpassword') where USER = 'root ';
Mysql> flush privileges;
Mysql> quit

#/Etc/init. d/mysqld restart
# Mysql-uroot-p
Enter password:
Mysql

When this problem was solved, a new problem occurred. When performing the update user operation, it was found that no response was found. select * from user; the result was blank, I wanted to grant a new user permission, but it was still old> it was not successful. Finally, a record was inserted directly in the user table, insert into User (Host, user, Password) values ('localhost', 'root', 'Password'); note that you need to add the permissions so that the user can have some permissions. Set these permissions to Y.

Okay, now all are OK, and you can operate the database in good condition. It is analyzed that the reason for the default data addition is mainly due to two reasons:

The mysql daemon is not started;

The mysql user table does not have a root user, or there is no user at all. You can simply add a user with the root permission.

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.