问题:springboot项目在用localhost连接mysql时没问题,但当localhost换成ip时出现

该问题:message from server: "Host 'DESKTOP-V8FMU6569' is not allowed to connect to this MySQL server"

意思是:该ip不能连接到mysql。

原因:mysql服务器在安装后,应该默认只能本地localhost才能连接。

解决:

 (1)有安装navicat的,打开找到myql数据库,里面有user表,把user表中的user为root的localhost改成%  。%代表通配,ip都可以访问,如下截图

(2)搞定后 cmd 进入自己mysql数据库

指令为:mysql->mysql-uroot -proot

  然后 mysql->flush privileges;

(3)再去启动自己项目,搞定。

如果没有用navicat,cmd进入mysql数据库

mysql -uroot -proot>use mysql;

mysql>update user set host = '%' where user = 'root';

mysql->flush privileges;

搞定。

参考:https://blog.csdn.net/mao_mao37/article/details/104298661

  https://blog.csdn.net/chaozhiwang/article/details/104295879

ip连接mysql时报不能连接的更多相关文章

  1. 【转载】在使用JDBC连接MySql时报错:You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support

    在使用JDBC连接MySql时报错:You must configure either the server or JDBC driver (via the serverTimezone config ...

  2. 解决使用DBeaver连接MySQL时报错-The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.

    解决使用DBeaver连接MySQL时报错,其实提示很明显. The server time zone value '�й���׼ʱ��' is unrecognized or represents ...

  3. idea启动服务连接mysql后 Navicat连接mysql就报错2013-Lost connection toMySQL server at

    我是使用navicat的windows端 连接centos下mysql服务器 第一次常规连接mysql正常,idea启动服务连接mysql后 Navicat连接mysql就报错2013-Lost co ...

  4. python MySQLdb连接mysql时报错

    故障现象: >>> import MySQLdb >>> conn = MySQLdb.connect(host=,charset="utf8" ...

  5. HttpResponse,render,redirect,静态文件配置,request对象方法,pycharm连接MySQL,django连接MySQL,django ORM

    HttpResponse 主要用于返回字符串类型的数据 def index(request): return HttpResponse('index页面') 在页面中就会显示 index页面 rend ...

  6. 使用navicat连接mysql时报错:2059 - authentication plugin 'caching_sha2_password'

    首先从本地登录mysql数据库,进入mysql控制台,输入如下命令: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_passwo ...

  7. 连接mysql时报:message from server: "Host '192.168.76.89' is not allowed to connect to this MySQL server 处理方案

    1.先用localhost方式连接到MySQL数据库,然后使用MySQL自带的数据库mysql; use mysql: 2.执行:select host from user where user = ...

  8. 连接mysql时报:message from server: "Host '192.168.76.89' is not allowed to connect to this MySQL server

    处理方案: 1.先用localhost方式连接到MySQL数据库,然后使用MySQL自带的数据库mysql; use mysql: 2.执行:select host from user where u ...

  9. Navicat Premium 12连接MySQL时报错2059和1045的解决办法

    参考连接:https://www.jianshu.com/p/15876ad165f5 https://jingyan.baidu.com/article/c275f6ba479ca9e33d7567 ...

随机推荐

  1. k8s系列---k8s认证及serviceaccount、RBAC

    http://blog.itpub.net/28916011/viewspace-2215100/ 对作者文章有点改动 注意kubeadm创建的k8s集群里面的认证key是有有效期的,这是一个大坑!! ...

  2. bash通配符 shell正则表达式

    在linux中 通配符是系统命令使用,一般用来匹配文件名或者什么的用在系统命令中. 通配符是系统级别的,通配符多用在文件名上,比如查找find,ls,cp,rm 正则表达式是操作字符串,以行尾单位来匹 ...

  3. 当前行的td值传入模态框

    <!-- 让include引用的页面,因为故障列表和周.月故障列表里面的table和分页是一样的前端页面,只有一点不同,没必要每个页面都写这些 --> <table id=" ...

  4. 查看Linux系统内存、CPU、磁盘使用率和详细信息

    一.查看内存占用 1.free # free -m 以MB为单位显示内存使用情况 [root@localhost ~]# free -m total used free shared buff/cac ...

  5. ssh常用命令大全

    ssh命令速查表 ssh-add ~/.ssh/your_private_key:输入你的私钥密码 就可以把你的私钥加入到ssh-agent中去 ssh-add -D: 删除所有管理的密钥 ssh-a ...

  6. asp.net MVC项目开发之统计图echarts饼形图(二)

    上面介绍了柱状图,只有js代码后台的传递等我们介绍完饼形图的使用过程在做介绍 有了柱状图的介绍,在使用饼形图,其实很容易了,上代码 1.首先加载网页时,需要用到的加载项和事件. //打开网页加载 $( ...

  7. centos7系统启动流程

    前提:pc主机,MBR架构 第一步:post(power on system test)加电自检. pc机的主板上有个rom芯片(CMOS),加电后,cpu去找这个raw,然后读取里面的指令,检测机器 ...

  8. netsh 查看自己的wifi密码。

    查看自己曾经连接过得wifi netsh wlan show profiles 断开wifi netsh wlan disconnect 查看密码 netsh wlan show profile na ...

  9. 从零开始一个个人博客 by asp.net core and angular(一)

    这是一个个人叙述自己建设博客的帖子,既然是第一篇那肯定是不牵扯代码了,主要讲一下大体的东西,微软最新的web框架应该就数asp.net core 3.1了这是一个长期支持版,而且是跨平台又开源版本,所 ...

  10. svn cleanup 失败问题解决

    将sqlite3.exe放到.svn的同级目录 4.启动cmd执行sqlite3 .svn/wc.db "select * from work_queue" 5.启动cmd执行sq ...