发布于 2014-12-06 08:48:29 | 3299 次阅读 | 评论: 1 | 来源: PHPERZ

这里有新鲜出炉的Mysql教程,程序狗速度看过来!

Mysql关系型数据库管理系统

MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。


本文为大家讲解的是mysql错误:mysqladmin: connect to server at 'localhost' failed的解决方法,感兴趣的同学参考下。

错误描述:

登陆mysql失败,通过mysqladmin修改密码失败,如下:

[root@mysql var]# mysqladmin -u root password '123456'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

解决步骤如下:

1 停止mysql服务
[root@mysql var]# /etc/init.d/mysqld stop
Shutting down MySQL.... SUCCESS!

2 安全模式启动
[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/

3 无密码root帐号登陆
[root@mysql var]# /usr/bin/mysql -uroot -p 【注释,在下面的要求你输入密码的时候,你不用管,直接回车键一敲就过去了】
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

4 手动update修改密码
mysql> update user set password=password("guxxxxxahyVh") 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
mysql> quit
Bye


5 正常重新启动
[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]#

6 重新登录

[root@mysql var]# mysql -uroot -p123445
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

搞定。



最新网友评论  共有(1)条评论 发布评论 返回顶部
kbumdew 发布于2016-01-24 17:38:59
10W个赞,感谢楼主!!
支持(0)  反对(0)  回复

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务