MySQL root Password Reset error: mysqladmin: connect to server at 'localhost' failed solution 1 login failed, failed to Change password of mysqladmin [root @ mysql var] # mysqladmin-u root password '000000' mysqladmin: connect to server at 'localhost' failederror: 'Access denied for user' root' @ 'localhost' (using password: NO) '2 stop mysql service [root @ mysql var] #/etc/init. d/mysqld stopShutting down MySQL .... SUCCESS! 3. Start [root @ mysql var] # mysqld_safe -- skip-grant-tables &/opt/mysql/product/5.5.25a/bin/mysqld_safe -- skip-grant-tables & [1] 10912 [root @ mysql var] #110407 17:39:28 mysqld_safe Logging to '/usr/local/mysql/var // mysql.chinascopefinanical.com. err '. 110407 17:39:29 mysqld_safe Starting mysqld daemon with databases from/usr/local/mysql/var/4 password-less root Account Login [root @ mysql var] #/usr/bin/mysql-uroot- p [note, You don't need to worry about the following requirements when you Enter the password. Press Enter to Enter the password.] Enter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 48 Server version: 5.1.41-log Source distribution Type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> use mysql; Database changed 5 manual update Change password mysql> update user set password = password ("guxxxxxahyotherwise") where user = 'root' and host = 'localhos T'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quitBye [root @ mysql var] # mysql-uroot-pguNNhtqhjUnfky6ahyVhWelcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 172 Server version: 5.1.41-log Source distribution Type 'help; 'or' \ H' for help. type '\ C' to clear the current Input statement. mysql> quitBye 6 restarts normally [root @ mysql var] # service mysqld restartShutting down MySQL .. 110407 17:45:29 mysqld_safe mysqld from pid file/usr/local/mysql/var // mysql.chinascopefinanical.com. pid endedSUCCESS! Starting MySQL... SUCCESS! [1] + Done mysqld_safe -- skip-grant-tables [root @ mysql var] #7 Analysis of other forms of errors 7.1 no sock found error: [root @ app60 mysqld] #/usr/bin/mysql-uroot-pEnter password: ERROR 2002 (HY000 ): can't connect to local MySQL server through socket '/var/lib/mysql. sock '(111) [root @ app60 mysqld] # Add the sock parameter when logging on. [Root @ app60 mysqld] #/usr/bin/mysql-uroot-p -- socket =/opt/mysqldata/mysql. sockEnter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 6 Server version: 5.1.69 Source distribution Copyright (c) 2000,201 3, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. other names may be trad Emarks of their respectiveowners. type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> 7.2 [ERROR]/usr/libexec/mysqld: Error writing file '/var/run/mysqld. pid '(Errcode: 28) 130830 10:59:02 InnoDB: Initializing buffer pool, size = 1.0G130830 10:59:02 InnoDB: Completed initialization of buffer pool130830 10:59:02 InnoDB: Started; log sequence number 0 2727887496130830 10:59:02 [ERROR]/usr/libexec/mysqld: Error writing file '/var/run/mysqld. pid '(Errcode: 28) 130830 10:59:02 [ERROR] Can't start server: can't create PID file: No space left on device130830 10:59:02 mysqld_safe Number of processes running now: 0130830 10:59:02 mysqld_safe mysqld restarted130830 10:59:02 InnoDB: Initializing buffer pool, size = 1.0G130830 10:59:02 InnoDB: Completed initialization of buffer pool130830 10:59:02 InnoDB: Started; log sequence number 0 2727887496130830 10:59:02 [ERROR]/usr/libexec/mysqld: Error writing file '/var/run/mysqld. pid '(Errcode: 28) 130830 10:59:02 [ERROR] Can't start server: can't create PID file: No space left on device130830 10:59:03 mysqld_safe Number of processes running now: 0130830 10:59:03 mysqld_safe mysqld res Tarted130830 10:59:03 InnoDB: Initializing buffer pool, size = 1.0G [Analysis]: The default pid file cannot be written. Modify/etc/init. d/mysqld: point the pid to another path [root @ app60 mysqld] # vi/etc/init. d/mysqld ..... get_mysql_option mysqld datadir "/var/lib/mysql" datadir = "$ result" get_mysql_option mysqld socket "$ datadir/mysql. sock "socketfile =" $ result "get_mysql_option mysqld_safe log-error"/var/log/mysqld. log "errlogfile =" $ result "get_mysql_optio N mysqld_safe pid-file "/opt/mysqldata/mysqld. pid "# '/var/run/mysqld. pid 'raw value. Here it is changed to another path/opt/mysqldata/mysqld. pidmypidfile = "$ result "..... then start the mysqld service. OK.