mysql执行mysql -h192.168.30.33 -uroot -p报错ERROR 1045 (28000): Access denied for user 'root'@'192.168.30.33' (using password: YES)的解决方法
1、报错详见如下
[root@localhost ~]# mysql -h192.168.30.33 -uroot -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'192.168.30.33' (using password: YES)
2、原因分析
mysql未开启远程访问,因此将不能通过如上的方式连接成功
3、解决措施
- 普通方式登入mysql
- 若使用root用户登录,则给root授权远程访问(注:用啥账号登录则给啥用户授权即可)
- 重启mysql
[root@localhost ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.36-log MySQL Community Server (GPL) Copyright (c) 2000, 2021, Oracle and/or its affiliates. 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> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION; (注:授权的命令) Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
mysql>exit;
[root@localhost ~]# cd /usr/local/mysql/support-files/ (注:mysql的安装目录下重启mysql)
[root@localhost support-files]# ./mysql.server restart
Shutting down MySQL.... SUCCESS!
Starting MySQL.. SUCCESS!
再次重新登录即可成功
1.作者:Syw 2.出处:http://www.cnblogs.com/syw20170419/ 3.本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 4.如果文中有什么错误,欢迎指出。以免更多的人被误导。 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-08-10 测试团队-工作规范内容梳理
2020-08-10 Excel---设置数据有效性并设置相应的样式