mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'
就当作自己忘记Mysql密码把,忘记密码的解决方法
一、mysql登录错误
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
无法修改密码
用 service mysqld stop
mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
>use mysql;
> update user set password=PASSWORD("newpass")where user="root";
更改密码为 newpassord
> flush privileges; 更新权限
> quit 退出
service mysqld restart
mysql -uroot -p新密码进入
===========================================================
二,忘记本地root的登录密码
解决过程:
1、编辑/etc/my.cnf
在[mysqld] 配置部分添加一行
skip-grant-tables
2、保存后重启mysql
[root@localhost etc]# service mysqld restart
Shutting down MySQL. [ OK ]
Starting MySQL. [ OK ]
3、登录数据库重新设置root密码
[root@localhost ~]# mysql -uroot -p mysql
Enter password:
直接回车进入
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.47-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
执行下列语句
mysql> update user set password=password("mysql") where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
4、删除/etc/my.cnf文件中添加的“skip-grant-tables”行,重启mysql;
用新设的密码就能正常登录了;
=================================================
介绍一个非常有用的mysql启动参数—— --skip-grant-tables。 顾名思义,就是在启动mysql时不启动grant-tables,授权表。有什么用呢?当然是忘记管理员密码后有用。
操作方法:
1、杀掉原来进行着的mysql:
rcmysqld stop
或者:
service mysqld stop
或者:
kill -TERM mysqld
2、以命令行参数启动mysql:
/usr/bin/mysqld_safe --skip-grant-tables &
3、修改管理员密码:
use mysql;
update user set password=password('yournewpasswordhere') where user='root';
flush privileges;
exit;
4、杀死mysql,重启mysql
mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'的更多相关文章
- Mac Mysql mysql_secure_installation Error: Access denied for user 'root'@'localhost' (using password: YES)
mysql由brew安装, 期间好像自动更新了一次 然后再次执行mysql_secure_installation, 输入root密码后报错, 重装mysql还是不行 Error: Access de ...
- 2003 -Can't connection to mysql server on | navicat for mysql Access denied for user 'root'@''ip'(using password :yes)
用本机windows上的Navicat for mysql链接虚拟机Linux的mysql数据库时,第一次连接的时候报的错误是 2003 -Can't connection to mysql serv ...
- mysql链接 显示 error: 'Access denied for user 'root'@'localhost' (using password: NO)'
解决方案 https://stackoverflow.com/questions/2995054/access-denied-for-user-rootlocalhost-using-password ...
- MySQL学习笔记——ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Enter password: E ...
- ERROR 1045 (28000): Access denied for user root@localhost (using password:
错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
MySQL安装完server端和客户端后,登录Mysql时报错:[root@rhel204 MySQL 5.6.23-RMP]# mysqlERROR 2002 (HY000): Can't conn ...
- 解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 问题(转载)
最近新装好的mysql在进入mysql工具时,总是有错误提示:# mysql -u root -pEnter password:ERROR 1045 (28000): Access denied fo ...
- mysql Access denied for user root@localhost错误解决方法总结(转)
mysql Access denied for user root@localhost错误解决方法总结(转) mysql Access denied for user \'root\'@\'local ...
- 解决mysql“Access denied for user 'root'@'localhost'”
解决mysql“Access denied for user 'root'@'localhost'” 分类: linux 2011-01-14 00:23 147547人阅读 评论(3) 收藏 举报 ...
随机推荐
- HDU2216:Game III(BFS)
Game III Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Subm ...
- Linux学习 -- Shell基础 -- Bash变量
变量 默认是字符串型,数值型需要显示指定 等号两侧都不能有空格 单引号:原始字符串 双引号:保留转义 命令结果作为值:反引号 或 $() 环境变量一般用大写 自定义变量 变量定义 name=& ...
- IDL 实现 EOF(经验正交函数分析)
关于EOF详细介绍请wiki http://en.wikipedia.org/wiki/Empirical_orthogonal_functions或者Google之. 与PCA一样,EOF也是遥感多 ...
- IDL 遍历 XML文档示例
IDL解析XML文档同样也有2种方法:DOM和SAX方式:两种方法在IDL自带的帮助里面有详细介绍,可以去查看. IDL 源码PRO sample_recurse, oNode, indent COM ...
- 单线驱动74hc595(转)
源:http://blog.chinaunix.net/uid-10701701-id-91938.html 这个电路是国外一个哥们2009年的时候发表的. http://www.romanblack ...
- Python3基础 Python的函数都有返回值 无指定返回值的函数 返回NONE对象
镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.-------------------------------------- ...
- c# 错误 两个输出文件名解析为同一个输出路径
检查同项目的其他文件夹下面已有其他同名窗体,影响设计器
- 初始化Direct3D
1.Direct3D概述 Direct3D是一套底层图形API,借助该API,我们能够利用硬件加速功能来绘制3D场景. 设备制造商将其产品支持的全部功能都实现到HAL中. 1.1 Direct3D提供 ...
- java正则表达式获取指定HTML标签的指定属性值
package com.mmq.regex; import java.util.ArrayList; import java.util.List; import java.util.regex.Mat ...
- line-box(转)
inline-block是什么? Inline-block是元素display属性的一个值.这个名字的由来是因为,display设置这个值的元素,兼具行内元素( inline elements)跟块级 ...