mysql登录报错 ERROR 1045 (28000)
1、现象:
[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
2、原因:数据库中存在空用户所致
3、解决方式:
1)停用mysql服务:# service mysql stop
2)输入命令:# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3)登入数据库:# mysql -u root mysql
4)mysql> use mysql;
5)mysql> select user,host,password from user; 结果例如以下:
+------+-----------------------+----------+
| user | host | password |
+------+-----------------------+----------+
| root | % | mima |
| root | localhost.localdomain | mima |
| root | 127.0.0.1 | mima |
| | localhost | |
| | localhost.localdomain | |
+------+-----------------------+----------+
6)将上面查询出来的空用户删除:mysql> delete from user where user='';
7)退出数据库:mysql> quit
8)启动mysql服务:# service mysql start
9)又一次用命令‘mysql -u root -p’登录。OK。
或者:
1)找到mysql的配置文件。改动my.cnf。在当中增加skip-grant-tables
2)重新启动数据库service mysql restart
3)免password使用root登录,然后查看user表、删除空用户
4)推出数据库。改动my.cnf。去掉skip-grant-tables
5)重新启动数据库
mysql登录报错 ERROR 1045 (28000)的更多相关文章
- 解决mysql登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题
问题描述: 在ubuntu14.04上安装完MYSQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误. 报错信息:Access denied ...
- 密码正确 mysql无法登陆 red7.3 上安装mysql5.6后登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passswd :yes)
集群需要mysql存储元数据,就在前几天还运行好好的,突然就进不去了......还是太菜,遇到的bug少. 引起这种故障的原因有很多......第一个坑比较多,大部分用户也就用第一个就可以解决问题,我 ...
- centos7 上安装mysql5.7后登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Yes 或者No)
原文转载自以下链接:https://blog.csdn.net/keepd/article/details/77151006 安装完mysql后会有个临时密码去日志查看,但是查看登录修改密后还是不行 ...
- CentOS命令登录MySQL时,报错ERROR 1045 (28000):
CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解 ...
- 升级到macOS 10.12 mysqlb报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
系统升级到macOS 10.12后启动mysql后,在终端输入mysql 报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' ...
- mysql安装在centos7报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
原文链接:http://blog.csdn.net/kuluzs/article/details/51924086 [问题]:mysql版本:5.7.13 首次在centos下安装MySQL,客户端连 ...
- mysql登录时,ERROR 1045 (28000): 错误解决办法
错误问题的描述: ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) ERROR 10 ...
- CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解决方法
1.停用mysql服务:# /etc/rc.d/init.d/mysqld stop 2.输入命令:# mysqld_safe --user=mysql --skip-grant-tables --s ...
- MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[root@pisphkdcbsql01 mysql3307]# /opt/mysql3307/bin/mysql -upisp -ppisp@ mysql: [Warning] Using a pa ...
随机推荐
- 找到程序真正的入口(使用IDE追踪)
一.程序的真正入口 main或WinMain只是“语法规定的程序入口” 并不是“应用程序入口”. 我们使用VC++ 6.0 的栈回溯功能,找到main函数之前的代码.菜单View -> Debu ...
- Makefile自动生成工具-----autotools的使用(详细)
相信每个学习Linux的人都知道Makefile,这是一个很有用的东西,但是编写它是比较复杂,今天介绍一个它的自动生成工具,autotools的使用.很多GNULinux的的软件都是用它生成Makef ...
- 由href return false 来看阻止默认事件
很多时候我们都想阻止一个a ?link的href跳转. 1 <a onclick=” return false ;” href=”www. 360 .cn”>click</a> ...
- Swift - 多线程实现方式(3) - Grand Central Dispatch(GCD)
1,Swift继续使用Object-C原有的一套线程,包括三种多线程编程技术: (1)NSThread (2)Cocoa NSOperation(NSOperation和NSOperationQueu ...
- SilkTest Q&A 10
92. 如何把单个表达式分两行来写? 答案1: 使用Shift + Enter 答案2: 很容易在online help里面找到答案: 1) line break in code 2) ...
- [Android学习笔记]Android向下兼
Android向下兼容的思路:使用高版本的API,在运行时判断真实运行平台的API版本,根据不同版本做不同的处理 关键类:Build.class里面定义了API版本相关信息 内部类:VERSION定义 ...
- mysql READ-COMMITTED 模式下 行锁不会升级到表级锁
mysql> select sn,id,info from s100 group by id; +-----+------+------+ | sn | id | info | +-----+- ...
- xPool - 基于mysqlclient的mysql的c++连接池 - xnhcx的个人空间 - 开源中国社区
xPool - 基于mysqlclient的mysql的c++连接池 - xnhcx的个人空间 - 开源中国社区 xPool - 基于mysqlclient的mysql的c++连接池
- Delphi 数据类型列表 good
Delphi 数据类型列表 分类 范围 字节 备注 简单类型 序数 整数 Integer -2147483648 .. 2147483647 4 有符号32位 Cardinal 0 .. 429496 ...
- iOS应用开发详解
<iOS应用开发详解> 基本信息 作者: 郭宏志 出版社:电子工业出版社 ISBN:9787121207075 上架时间:2013-6-28 出版日期:2013 年7月 开本:16开 ...