mysql设置对外访问
报错:Host is not allowed to connect to this MySQL server解决方法
先说说这个错误,其实就是我们的MySQL不允许远程登录,所以远程登录失败了,解决方法如下:
在装有MySQL的机器上登录MySQL mysql -u root -p密码
[root@localhost ~]# mysql -u root -p
Enter password:
执行use mysql;
mysql > use mysql;
执行update user set host = '%' where user = 'root';这一句执行完可能会报错,不用管它。
执行FLUSH PRIVILEGES;
全部命令
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 8.0. MySQL Community Server - GPL Copyright (c) , , 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> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> update user set host = '%' where user = 'root';
Query OK, row affected (0.06 sec)
Rows matched: Changed: Warnings: mysql> FLUSH PRIVILEGES;
Query OK, rows affected (0.00 sec) mysql>
经过上面4步,就可以解决这个问题了。
注: 第四步是刷新MySQL的权限相关表,一定不要忘了,我第一次的时候没有执行第四步,结果一直不成功,最后才找到这个原因。
如果以上还不能解决问题,可以尝试
报错:authentication plugin 'caching_sha2_password
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
以上两步骤基本可以解决 mysql对外访问了
mysql设置对外访问的更多相关文章
- Mysql 设置外部访问
mysql> use mysql; mysql> GRANT ALL ON *.* TO user@' WITH GRANT OPTION; mysql -h172. -uuser -p1 ...
- mysql设置外网访问
公司有个mysql的数据库放在221服务器上,做手机app数据库连接的时候,本地调试没问题,一旦更新到外网142手机服务器(220.230.190.142),就是数据库连接超时.想到可能是mysql没 ...
- [linux] mysql跨服务器访问, iptables设置
跨服务器mysql访问, iptables配置 1> 设置被访问机器的mysql权限 grant all privileges on *.* to root@"[ip]" i ...
- iptables/mysql设置指定主机访问指定端口
本周,运维告知部署的服务被扫描发现漏洞,涉及的软件分别为mysql,ZooKeeper与Elasticsearch. 因为最近任务繁重,人力资源紧张,因此无法抽出更多时间调整代码,添加权限认证. 与软 ...
- MySql修改root密码、设置IP访问
先登录:mysql -h 192.168.5.116 -P 3306 -u root -p123456 首次登陆无密码命令:mysql -h 192.168.5.116 -P 3306 -u root ...
- cxf设置代理访问webservice接口
由于业务上的需要,需要访问第三方提供的webservice接口,但由于公司做了对外访问的限制,不设置代理是不能外网的,如果使用http设置代理访问外网还是比较容易的,但使用cxf有点不知道从哪里入手. ...
- MySQL设置远程连接
Window下MySQL设置开启远程连接mysql数据库 1.新建用户远程连接mysql数据库grant all on *.* to admin@'%' identified by '123456' ...
- MYSQL设置远程账户登陆总结,mysql修改、找回密码、增加新用户,MySQL数据库的23个注意事项
1.5 设置及修改Mysql root用户密码1 设置密码方法mysqladmin -u root password '123456'mysqladmin -u root -p'123456' pas ...
- 为 MySQL 设置默认字符集(UTF-8)避免产生乱码
环境:Windows 7+Wamp Server+MySQL 5.7.9 查看MySQL默认编码: SHOW VARIABLES LIKE 'character%' character_set_cli ...
随机推荐
- Hadoop学习博客
http://zy19982004.iteye.com/blog/monthblog_more
- js获取本机id
var hostname = location.hostname; window.location.href="http://"+hostname+":8080/zhib ...
- 解决 Mac 的 Terminal 中,Java 乱码的问题
在 .bash_profile 文件中,增加如下行: export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 然后,重新加载该配置 source .bash_pr ...
- markdown 语法和工具
一 简明语法 来自: http://maxiang.info/ 二 markdown 语法: https://github.com/rhiokim/haroopad/blob/develop/Syn ...
- C# Redis缓存过期实现延迟通知实战演练
一.场景描述 在实际开发过程中经常会遇到一些有时效性数据的业务场景,比如订单支付处理超时提醒.当用户在商城上进行下单支付,我们假设如果8小时没有进行支付,那么就后台自动对该笔交易的状态修改为订单关闭取 ...
- 【Spark】Sparkstreaming-性能调优
Sparkstreaming-性能调优 Spark Master at spark://node-01:7077 sparkstreaming 线程 数量_百度搜索 streaming中partiti ...
- [Mockito] Spring Unit Testing with Mockito
It is recommened to write unit testing with Mockito in Spring framework, because it is much faster w ...
- 浅谈压缩感知(二十三):压缩感知重构算法之压缩采样匹配追踪(CoSaMP)
主要内容: CoSaMP的算法流程 CoSaMP的MATLAB实现 一维信号的实验与结果 测量数M与重构成功概率关系的实验与结果 一.CoSaMP的算法流程 压缩采样匹配追踪(CompressiveS ...
- Json解析包FastJson使用
阿里巴巴FastJson是一个Json处理工具包,包括“序列化”和“反序列化”两部分,它具备如下特征:速度最快,测试表明,fastjson具有极快的性能,超越任其他的Java Json parser. ...
- 使用Kotlin优雅的开发Android应用
来源:https://juejin.im/post/5915c0a744d904006c4e3bcd demo下载地址:https://github.com/xiehui999/KotlinForAn ...