美文网首页
解决Connections could not be acqui

解决Connections could not be acqui

作者: 贝影grass | 来源:发表于2019-07-28 22:50 被阅读0次

    搭建sm运行时报错

    在用sm搭建项目报了如下一系列错误,为远程连接mysql8时的错误
    image.png
    image.png

    解决方案

    1.驱动配置有误:driver=com.mysql.cj.jdbc.Driver
    2.数据库连接地址有误:url=jdbc:mysql://localhost:3306/test?3useUnicode=true&characterEncoding=utf8
    3.密码或帐号有误:username=root
    password=root
    4.数据库未启动或无权访问
    5.mysql root没有远程访问的权限,需要增加权限,增加权限的步骤如下:
    进入mysql数据库:
    grant all privileges on . to 'root'@'%' identified by 'root' with grant option;
    flush privileges;

    如果上述都没错的话就应该是第6点这个错误,我便是遇到了这个错误,困扰了好几天

    6.mysql依赖引入无效,在项目中直接引入mysql-connector-8.0.16.jar包


    image.png

    后续可能会报时区异常

    image.png
    添加时区即可,需要在数据库 URL中设置serverTimezone属性 image.png
    其中 GMT%2B8 代表是东八区。

    接下来接着报了连接池出c3p0版本过低问题

    image.png
    只需将依赖版本提升到0.9.5.2即可
    image.png

    一系列错误解决后项目即可运行成功。

    相关文章

      网友评论

          本文标题:解决Connections could not be acqui

          本文链接:https://www.haomeiwen.com/subject/qvsmrctx.html