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 ...
随机推荐
- UML类图的几个名词及对应符号
实现(Implements) 实现的符号为:\(--- \triangleright\) 箭头指向接口. 泛化/继承(Inheritance) 继承的符号为:$ -\triangleright $ 箭 ...
- PID控制器(比例-积分-微分控制器)- II
Table of Contents Practical Process Control Proven Methods and Best Practices for Automatic PID Cont ...
- 针对UDP丢包问题,进行系统层面和程序层面调优
转自:https://blog.csdn.net/xingzheouc/article/details/49946191 1. UDP概念 用户数据报协议(英语:User Datagram Proto ...
- linux性能采用工具oprofile使用
1.先收藏几篇博文,先解决问题,周末继续. http://www.cnblogs.com/bangerlee/archive/2012/08/30/2659435.html http://blog.s ...
- Shell获取某目录下所有文件夹的名称
查看目录下面的所有文件: #!/bin/bash cd /目标目录 for file in $(ls *) do echo $file done 延伸的方法,查看目录下面的所有目录 #!/bin/ba ...
- PL/SQL学习笔记之循环语句
一:基本循环 LOOP 循环体: 退出循环: )IF condition THEN exit; END IF; ) exit WHEN condition; END LOOP; 二:WHILE循环 W ...
- springMVC之mvc:interceptors拦截器的用法
1.配置拦截器 在springMVC.xml配置文件增加: <mvc:interceptors> <!-- 日志拦截器 --> <mvc:interceptor> ...
- 【SqlServer】解析SqlServer中的事务
目录结构: contents structure [+] 事务是什么 控制事务 数据并发访问产生的影响 事务的隔离级别 锁 NOLOCK.HOLDLOCK.UPDLOCK 死锁分析 在这篇Blog中, ...
- 【C#】C#中方法(函数)的类型有哪些
目录结构: contents structure [+] 构造函数 引用类型的构造函数 值类型的构造函数 析构函数 析构函数的使用 析构函数和Dispose()方法的区别 操作符重载 转化操作符方法 ...
- mechanize (1)
最近看的关于网络爬虫和模拟登陆的资料,发现有这样一个包 mechanize ['mekə.naɪz]又称为机械化的意思,确实文如其意,确实有自动化的意思. mechanize.Browser and ...