当前位置:网站首页> MySQL8.0开启远程连接权限的方法步骤
MySQL8.0开启远程连接权限的方法步骤
2022-06-30 15:41:00 【1024问】
问题描述:
报错原因:
解决方法:
总结
问题描述:开发环境:MySQL8+Centos8;
执行MySQL语句:mysql -h 180.76.XXX.XX -u root -pPassword;
ERROR 1130 (HY000): Host ‘180.76.XXX.XX’ is not allowed to connect to this MySQL server
解决方法:首先,检查要连接数据库的服务器的防火墙等是否关闭,检查与服务器连接是否通畅(方法:在cmd控制台中 输入 ping ip地址)
接下来,进入正题:
具体操作步骤如下:
登录本地MySQL库, 切换至database= “mysql” 下,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从"localhost"改称"%" :
执行的mysql命令如下:
【1】mysql命令连接要开启远程连接权限的本地mysql库>mysql -u root -pPassWord # ”root“为登录账号,”Password“为登录密码,按自己设置的修改>use mysql; # 使用的database名称为”mysql“>update user set host = '%' where user = 'root'; # 修改”root“账号的配置信息# update user set host='%' where user='test'; ## 如果账号是“test”,使用该命令>select host, user from user; # 验证修改成功;在mysql命令行的具体执行结果如下图:

2. 此时“如果连接远程MySQL,还是没连接上”时,则再继续执行操作 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;进行账号授权,之后执行FLUSH PRIVILEGES; 进行刷新,即可。" :
>mysql -u root -pPassWord # ”root“为登录账号,”Password“为登录密码,按自己设置的修改 # 连接MySQL数据库>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; # 授权# Grant all privileges on test.* to 'test'@'%'; # 如果账号为“test”时,使用该命令>FLUSH PRIVILEGES; # 刷新>EXIT; # 退出MySQL在mysql命令行的具体执行结果如下图:

备注:注意这里一定要以英文分号结尾!!!
这时没有上面的ERROR 1133错误了,经过测试,已经能连接到远程服务器了。
总的执行步骤如下:

参考文献:
对MySQL开放远程连接权限的方法
解决mysql8报错:ERROR 1410 (42000): You are not allowed to create a user with GRANT
总结到此这篇关于MySQL8.0开启远程连接权限的文章就介绍到这了,更多相关MySQL8.0开启远程连接权限内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!
边栏推荐
- 婴儿认知学习所带来的启发,也许是下一代无监督机器学习的关键
- 4.8 data type conversion
- Is your light on? Before you start to solve a problem, you need to know what the "real problem" is
- Pycharm----xx. So cannot open shared object file problem solving
- 终于看懂科学了!200张图领略人类智慧的巅峰
- The difference between intermodulation and intermodulation
- topic: Privacy, Deception and Device Abuse
- Smart wind power: operation and maintenance of digital twin 3D wind turbine intelligent equipment
- flink sql cdc 同步sqlserver 报错什么原因啊
- 【Leetcode】链表排序(逐步提高时空复杂度)
猜你喜欢

优惠券种类那么多,先区分清楚再薅羊毛!

ASP. Send information in sinalr controller of net core

C language foundation - pointer array - initialization method & constant pointer array, pointer constant array

Model system: Sword (1)

数据治理市场:亿信华辰朝左,华傲数据向右

Oracle中的With As 子查询

【算法篇】四种链表总结完毕,顺手刷了两道面试题

Policy Center > Misrepresentation

互联网研发效能之去哪儿网(Qunar)核心领域DevOps落地实践

今晚19:00知识赋能第2期直播丨OpenHarmony智能家居项目之控制面板界面设计
随机推荐
深入分析GadgetInspector核心代码
About pickle module - 6 points that beginners must know
构建适合组织的云原生可观测性能力
超 Nice 的表格响应式布局小技巧
Cesium-1.72 learning (deploy offline resources)
Does flinkcdc have to be a clustered version if the monitored database is Mongo
4.1 print function
Summary of gradient descent optimizer (rmsprop, momentum, Adam)
Simulation of two-color ball system to judge the winning situation
Log4j2 进阶使用
Solution for IIS failing to load font files (*.woff, *.svg)
【Unity UGUI】ScrollRect 动态缩放格子大小,自动定位到中间的格子
优惠券种类那么多,先区分清楚再薅羊毛!
Swagger's asp Net core web API help page
Simulate user login function
Implementation of Devops in the core field of qunar, the Internet R & D Efficiency
消息队列十连问
Policy Center-Permissions and APIs that Access Sensitive Information
分布式机器学习:模型平均MA与弹性平均EASGD(PySpark)
Flask-SQLAlchemy----sqlalchemy. exc.InvalidRequestError: SQL expression, column, or mapped e---ORM(9)