MySQLroot password reset error: mysqladmin: connecttoserverat 'L _ MySQL

Source: Internet
Author: User
MySQLroot password reset error: mysqladmin: connecttoserverat bitsCN.com

MySQL root password reset error: mysqladmin: connect to server at 'localhost' failed solution

1. login failed. mysqladmin failed to change password

[Root @ mysql var] # mysqladmin-u root password '123'

Mysqladmin: connect to server at 'localhost' failed

Error: 'Access denied for user' root' @ 'localhost' (using password: NO )'

2. stop the mysql service.

[Root @ mysql var] #/etc/init. d/mysqld stop

Shutting down MySQL... SUCCESS!

3. start in security mode

[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. log on with the root account without a password

[Root @ mysql var] #/usr/bin/mysql-uroot-p [Note: You do not need to worry about the password when you are required to enter the password, press the enter key and you will be taken over]

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. manually update the password

Mysql> update user set password = password ("guxxxxxahyotherwise") where user = 'root' and host = 'localhost ';

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> quit

Bye

[Root @ mysql var] # mysql-uroot-pgunnhtqhjunfky6ahyh _

Welcome 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> quit

Bye

6. restart normally

[Root @ mysql var] # service mysqld restart

Shutting down MySQL .. 110407 17:45:29 mysqld_safe mysqld from pid file/usr/local/mysql/var // mysql.chinascopefinanical.com. pid ended

SUCCESS!

Starting MySQL... SUCCESS!

[1] + Done mysqld_safe -- skip-grant-tables

[Root @ mysql var] #

7. other forms of error analysis

7.1 if no sock is found, an error is returned:

[Root @ app60 mysqld] #/usr/bin/mysql-uroot-p

Enter 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. sock

Enter 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 its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help; 'or'/h' for help. type'/C' to clear the current input statement.

Mysql>

Mysql>

7.2 ERROR [Error]/usr/libexec/mysqld: ERROR writing file '/var/run/mysqld. pid' (Errcode: 28)

130830 10:59:02 InnoDB: Initializing buffer pool, size = 1.0G

130830 10:59:02 InnoDB: Completed initialization of buffer pool

130830 10:59:02 InnoDB: Started; log sequence number 0 2727887496

130830 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 device

130830 10:59:02 mysqld_safe Number of processes running now: 0

130830 10:59:02 mysqld_safe mysqld restarted

130830 10:59:02 InnoDB: Initializing buffer pool, size = 1.0G

130830 10:59:02 InnoDB: Completed initialization of buffer pool

130830 10:59:02 InnoDB: Started; log sequence number 0 2727887496

130830 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 device

130830 10:59:03 mysqld_safe Number of processes running now: 0

130830 10:59:03 mysqld_safe mysqld restarted

130830 10:59:03 InnoDB: Initializing buffer pool, size = 1.0G

[Analysis]: if the default pid file cannot be written, modify/etc/init. d/mysqld and 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_option mysqld_safe pid-file "/opt/mysqldata/mysqld. pid "# '/var/run/mysqld. pid 'raw value. here it is changed to another path/opt/mysqldata/mysqld. pid

Mypidfile = "$ result"

.....

Then start the mysqld service. OK.

BitsCN.com

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.