新装MySql后登录出现root帐号提示mysql ERROR 1045 (28000): Access denied for use的解决办法
作者:侠之大者为国为民 时间:2024-01-21 13:48:06
新装MySQL后,首次执行 mysql -uroot -p
后会发现root密码不为空,要重置root密码请参考以下步骤。
编辑mysql配置文件my.ini(如果是my_default.ini请改名为my.ini),在[mysqld]这个条目下加入
skip-grant-tables
保存退出后重启mysql,点击“开始”->“运行”(快捷键Win+R)。
1.停止:输入 net stop mysql
2.启动:输入 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 setauthentication_string=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就可以了。
再次重新登录后会提示你
ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo re executing this statement.
只要输入 set password=password('新密码');
即可
以上所述是小编给大家介绍的新装MySql后登录出现root帐号提示mysql ERROR 1045 (28000): Access denied for use的解决办法网站的支持!
来源:http://blog.csdn.net/sofeien/article/details/54670801
标签:mysql,1045,access,denied
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python的sys.path模块路径添加方式
2021-04-06 05:52:30
![](https://img.aspxhome.com/file/2023/7/133597_0s.jpg)
php简单定时执行任务的实现方法
2023-08-19 21:34:09
Python实现异常检测LOF算法的示例代码
2023-11-03 08:05:01
![](https://img.aspxhome.com/file/2023/0/133710_0s.png)
关于go-zero服务自动收集问题分析
2024-04-26 17:29:51
![](https://img.aspxhome.com/file/2023/8/134028_0s.jpg)
用户体验设计何去何从,交互设计师又何去何从?
2009-12-28 13:07:00
![](https://img.aspxhome.com/file/UploadPic/20101/11/2009-09-17_01-34s.png)
Python使用Pickle库实现读写序列操作示例
2022-05-15 03:53:03
Python实现扫码工具的示例代码
2022-07-06 06:06:36
MYSQL初学者命令行使用指南
2024-01-15 08:46:33
![](https://img.aspxhome.com/file/2023/0/102380_0s.jpg)
详解pandas中Series()和DataFrame()的区别与联系
2023-06-24 23:05:46
WAP2.0网页设计中的交互细节
2010-08-12 20:50:00
![](https://img.aspxhome.com/file/UploadPic/20108/12/01-47s.jpg)
跟我学习javascript的基本类型和引用类型
2024-04-28 09:46:42
![](https://img.aspxhome.com/file/2023/5/132775_0s.png)
浅析Python 中整型对象存储的位置
2021-10-06 13:40:20
python面试题之列表声明实例分析
2022-01-10 12:46:51
![](https://img.aspxhome.com/file/2023/5/84075_0s.png)
python编程开发时间序列calendar模块示例详解
2023-04-25 14:59:19
![](https://img.aspxhome.com/file/2023/7/131447_0s.jpg)
pandas group分组与agg聚合的实例
2023-01-04 14:22:28
python使用正则表达式(Regular Expression)方法超详细
2022-09-07 14:30:53
![](https://img.aspxhome.com/file/2023/4/109934_0s.png)
Python数据类型--字典dictionary
2023-06-19 12:49:53
![](https://img.aspxhome.com/file/2023/6/94106_0s.png)
一文教会你用Python读取PDF文件
2021-03-23 00:24:55
![](https://img.aspxhome.com/file/2023/6/102896_0s.png)
MySQL 8.0新功能监控统计限制连接不再担心被垃圾SQL搞爆内存
2024-01-16 12:51:25
Python利用flask sqlalchemy实现分页效果
2023-10-05 16:36:21
![](https://img.aspxhome.com/file/2023/5/86185_0s.jpg)