mysql ERROR 1045 (28000): Access denied for user 可能解决方法分析
在实际登录redmine的过程中,我们遇到了如下的error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) ERROR 1045 (28000): Access denied for user 'redmine'@'localhost' (using password: YES)
Solution 1---空用户error.
Solution 2---Windows 重置mysql root账户密码.
Solution 2---Linux 重置mysql root账户密码.
==============================================
以下结合网上的解决方案进行了初步分析:
Solution 1---空用户error
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!
Solution 2---Windows 重置mysql root账户密码.
搜索Windows上mysql目录的my.ini文件,
在[mysqld]这个条目下加入 skip-grant-tables
保存退出后重启mysql
1.点击“开始”->“运行”(快捷键Win+R)。
2.停止:输入 net stop mysql
3.启动:输入 net start mysql
这时候在cmd里面输入mysql -u root -p就可以不用密码登录了,出现password:的时候直接回车可以进入,不会出现ERROR 1045 (28000),但很多操作都会受限制,因为我们不能grant(没有权限)。
按下面的流程走(红色部分为输入部分,粉红色的是执行后显示的代码不用输入):
1.进入mysql数据库:
mysql> use mysql;
Database changed
2.给root用户设置新密码,蓝色部分自己输入:
mysql> update user set password=password("新密码") where user="root";
Query OK, 1 rows affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
3.刷新数据库
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
4.退出mysql:
mysql> quit
Bye
改好之后,再修改一下my.ini这个文件,把我们刚才加入的"skip-grant-tables"这行删除,保存退出再重启mysql就可以了。
Solution 2---Linux 重置mysql root账户密码.
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> update user set password=password("新密码") where user="root";
Query OK, 0 rows affected (0.13 sec)
Rows matched: 4 Changed: 0 Warnings: 0
6、刷新数据库
mysql> flush privileges;
Query OK, 0 rows affected (0.05 sec)
mysql> quit
Bye
6、重启 $ sudo service mysql start
mysql start/running, process 12719
7、登录:
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.5.54-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2016, 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>
成功登录。
欢迎交流!
参考:
http://www.jb51.net/article/82421.htm
http://blog.sina.com.cn/s/blog_759a5a7c01017dj0.html
mysql ERROR 1045 (28000): Access denied for user 可能解决方法分析的更多相关文章
- 【MySQL】ERROR 1045 (28000): Access denied for user的解决方法
去官网下载压缩版的MySQL Server,解压配置path环境变量后.然后克隆my-default.ini创建my.ini文件,在文件中[mysqld]下面配置basedir和datadir bas ...
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)
安装mysql后,使用命令登录mysql居然报错了,Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using ...
- 【技术贴】解决Mysql ERROR 1045 (28000): Access denied for
今天Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' 肯定是密码不对了.那么重置一下密码吧. 打开 cmd 输入以 ...
- 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 ...
- MYSQL ERROR 1045 (28000) Access denied for user (using password YES)问题的解决
我的Linux是Centos6.7的版本,本机上Mysql突然怎么连接都进不去 报错:MYSQL ERROR 1045 (28000) Access denied for user (using pa ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'解决
MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'解决: # /etc/init.d/mysql stop # my ...
- MySql ERROR 1045 (28000): Access denied 错误
[MySql ERROR 1045 (28000): Access denied 错误] 即登陆错误,使用MySql登陆时,需使正确的username/passwd.通过 -u -p 参数即可. My ...
- 解决Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'问题
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Red Hat Enterpris ...
- 转-解决Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'问题
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Red Hat Enterpr ...
随机推荐
- asp.net 中长尾链接实现推送 -- comet
一般需求推送服务时,都会去第三方拿推送组件,如”极光“,”百度“,”小米"什么的,自己用.net实现推送服务端需要面对很多问题,比如C10K,但是企业内部使用往往用不了10K的链接,有个1K ...
- webuploader传递参数
实际开发过程中,比如我有个工单提交系统,提交工单的时候用webuploader上传图片,如果工单的ID是自增长类型的,那么我在上传图片的时候肯定需要关联上工单的id,这时候就需要通过webupload ...
- 批量远程执行shell命令工具
使用示例(使用了默认用户root,和默认端口号22): ./mooon_ssh --h=192.168.4.1,192.168.4.2 -P=password -c='cat /etc/hosts' ...
- http://blog.csdn.net/zgl07/article/details/43491399
转载申明:本文转载自http://www.brendangregg.com/perf.html 请大家看了之后如果要转载一定要注上这个地址!!! ========================= ...
- HDU1241 Oil Deposits 2016-07-24 13:38 66人阅读 评论(0) 收藏
Oil Deposits Problem Description The GeoSurvComp geologic survey company is responsible for detectin ...
- hbase使用MapReduce操作4(实现将 HDFS 中的数据写入到 HBase 表中)
实现将 HDFS 中的数据写入到 HBase 表中 Runner类 package com.yjsj.hbase_mr2; import com.yjsj.hbase_mr2.ReadFruitFro ...
- Code Review Checklist and Guidelines for C# Developers
Checklist1. Make sure that there shouldn't be any project warnings.2. It will be much better if Code ...
- Linq to Object 的简单使用示例
语言集成查询 (LINQ) 是 Visual Studio 2008 中引入的一组功能,可为 C# 和 Visual Basic 语言语法提供强大的查询功能. LINQ 引入了标准易学的数据查询和更新 ...
- DBCC--SHOWCONTIG
DBCC SHOWCONTIG是显示指定的表的数据和索引的碎片信息. Usage: dbcc SHOWCONTIG [ ( { 'table_name' | table_id | 'view_name ...
- 找不到请求的 .Net Framework Data Provider
1.安装 mysql-connector-net-6.9.10.msi 2.修改C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine ...