[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# /etc/init.d/mysqld stop
/etc/init.d/mysqld: line 16: .: /etc/sysconfig/network-scripts: is a directory
Stopping mysqld: [ OK ]
[root@localhost ~]# vi /root/mypassreset.sql
[root@localhost ~]# mysqld_safe --init-file=/root/mypassreset.sql &
[1] 12212
[root@localhost ~]# 120227 16:40:08 mysqld_safe Logging to '/var/log/mysqld.log'.
120227 16:40:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120227 16:40:14 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
[1]+ Done mysqld_safe --init-file=/root/mypassreset.sql
[root@localhost ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
[root@localhost ~]# service mysqld start
/etc/init.d/mysqld: line 16: .: /etc/sysconfig/network-scripts: is a directory
Starting mysqld: [ OK ]
[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
This Post was from: https://www.centos.org/newbb/viewtopic.php?forum=56&topic_id=36030&post_id=155972