• 远程连接MySQL MySQL的远程连接


    笔记本上安装了mysql, 想测试一下连接池对性能的影响,用了另一台PC来测试一段sql,出现以下错误:

    jdbc:mysql://10.201.11.128:3306/test

    Cannot create PoolableConnectionFactory (null,  message from server: "Host '10.201.10.53' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'")

    根据网上教程,在mysql库中更新host的值为%,之后也刷新了,却还是遇到上述的错误

    use mysql;

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

    这样在远端就可以通过root用户访问Mysql.

    第二种方式 赋权 也是不行

     grant all privileges on *.* to 'root' @  '%' identified  by 'mypassword' with grant option

    *.*     所有数据库下的所有表

    myuser  哪一个用户可以访问:  

       哪些主机   所有的主机

    如果只希望某一台主机访问,那将% 改为ip地址

    mypassword:  访问者以什么密码来访问

    执行成功之后,需要进行刷新

    flush privileges

     

    后来查看到新版mysql更改方式,如下

    use mysql;

    alter user 'root'@'%' identified with mysql_native_password by 'root';

    flush privileges;

    Cannot create PoolableConnectionFactory (Could not create connection to database server.)

    查看了一下我的mysql版本,

    原因是mysql驱动版本太低导致,后来下载了最新的驱动 【https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.13

    Error preloading the connection pool

     连接数太大,更改JDBC Connection Configuration中的最大连接数

    终于可以了。。。

  • 相关阅读:
    Centos7 安装配置Elasticsearch
    单例模式
    Eclipse上部署maven项目
    单点登录
    各eclipse插件的作用
    eclipse中安装Subclipse插件
    往idea中导入已有的web项目
    maven 项目部署
    【转帖】算法刷题网站
    混淆矩阵-MATLAB代码详解
  • 原文地址:https://www.cnblogs.com/qianjinyan/p/10248046.html
Copyright © 2020-2023  润新知