问题: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. NR / 5G - The Best CQI algorithm

  2. sparc v8 stack frame calling convention

    main.c ; int main() { int a, b; int sum; a = ; b = ; sum = add(a, b); ; } int add(int a, int b) { in ...

  3. 关于开源,Git,Github

    在Github和Git上fork之简单指南 https://linux.cn/article-4292-1.html,中文翻译 https://www.dataschool.io/simple-gui ...

  4. OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

    gitlab版本为社区版: gitlab-ce_11.5.4-ce.0_amd64.deb 目录:/var/cache/apt/archives 配置邮箱的主要参数: user['git_user_e ...

  5. 编译安装nginx提示./configure: error: C compiler cc is not found

    1 编译安装nginx提示如下 ./configure: error: C compiler cc is not found 2 解决办法 yum -y install gcc gcc-c++ aut ...

  6. django 中 cookie与session 相关的知识

    cookie :它是一个字典  

  7. dict的使用

    Python字典是可变类型数据,可以存储任意对象,如字符串,数字,元组,列表等. 字典的创键 字典有键key和值value组成,使用键值对链接:,字典也称为关联数组或哈希表. dict_person ...

  8. ES6 - 报错整理(1): Unexpected end of JSON input while parsing near '...es":"7.0.0-alpha.11",'

    npm install --save-dev 安装 babel-preset-env时一直报错 Unexpected end of JSON input while parsing near '... ...

  9. html文件如何下载文件

    HTML中下载文件两种方法:a标签下载:js下载; <!-- 网页地址和图片地址同源的情况下这样是可以的,不同源则是直接打开这个地址 --> <!-- 方法一:同源情况下载 --&g ...

  10. Python——面向对象,简易学生信息管理系统

    一.概述 1.1涉及到的知识点 项目开发:创建项目,创建包,导入包: 面向对象:静态方法,继承,内置函数,自定义函数: 数据类型:列表,字典,字符串.列表.字典的转换和自动生成导向: 异常处理:捕获异 ...