Mysql安装,解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
2021/7/8 19:08:36
本文主要是介绍Mysql安装,解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
之前文章 软件测试从业者必备 之 MYSQL从零到入坑 。
上次,给大家的Mysql入门完整文章,包含了多数问题。
但,今晚在录制视频时,又发现了如下问题,补充之 。
/
安装完成后,服务启动,登陆时 。
# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决方法很简单,如下:
# /etc/init.d/mysqld stop //停止mysql服务的运行
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & //跳过受权表访问
# mysql -u root mysql //登录mysql
1. 在mysql5.7以下的版本如下:
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='127.0.0.1' or host='localhost';//把空的用户密码都修改成非空的密码就行了。
2. 在mysql5.7版本如下:
update mysql.user set authentication_string=password('newpassword') where user='root' and host='127.0.0.1' or host='localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart //离开并重启mysql
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
搞定 。
这篇关于Mysql安装,解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-25MySQL报错Duplicate entry '0' for key 'PRIMARY'
- 2024-05-29阿里 Canal 实时同步 MySQL 增量数据至 ClickHouse 数据库
- 2024-05-24在Linux下管理MySQL的大小写敏感性
- 2024-04-26MySQL查出时间比实际晚8小时的解决方案
- 2024-04-01JPA不识别MySQL的枚举类型
- 2024-03-30mysql数据库表卡死解决方法
- 2024-03-15MySQL多数据源笔记5-ShardingJDBC实战
- 2024-03-11natural join mysql
- 2024-03-11关于VS2017,VS2015 中利用 EF使用Mysql 不显示数据源问题解决方案
- 2024-02-26mysql 阿里云xb后缀备份文件恢复-icode9专业技术文章分享