zoukankan      html  css  js  c++  java
  • 远程连接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中的最大连接数

    终于可以了。。。

  • 相关阅读:
    关于一道PHP面试题的解法
    ThinkPHP学习(二)
    ThinkPHP学习(一)
    Apache 创建虚拟主机目录和设置默认访问页面
    awk全集
    初识云计算&openstack
    Python collections
    Python 函数/高阶函数
    Python dic/set/迭代
    python matplotlib 图标绘制
  • 原文地址:https://www.cnblogs.com/qianjinyan/p/10248046.html
Copyright © 2011-2022 走看看