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.