zoukankan      html  css  js  c++  java
  • java mysql常见问题

    1.com.alibaba.druid.pool.DruidDataSource : create connection error, url: jdbc:mysql://

    1)未开启远程操作权限

    win+R->cmd进入登录自己的mysql:
    输入命令:mysql -u root -p ****(输入自己的密码)
    输入远程命令:GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;(输入自己的用户名和密码)
    刷新:flush privileges;
    

      

    2)需要在项目的application.yml配置中加上:(遇到The server time zone value '�й���׼ʱ��' is unrecogni同理)

    &useSSL=false&serverTimezone=UTC
    

      

    3)

    2.Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. 

    整合spring boot项目过程中出现的,用了最新的mysql 连接驱动

    application-dev.properties

    spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver

    需要将 com.mysql.jdbc.Driver  改为  com.mysql.cj.jdbc.Driver

    spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
  • 相关阅读:
    官方源、镜像源汇总
    Kubernetes V1.15 二进制部署集群
    ZABBIX 4.0 LTS 部署
    SSH + Google Authenticator 安全加固
    Hadoop+HBase 集群搭建
    自动化运维之PSSH
    KVM之CPU虚拟化
    GoAccess日志分析工具
    HTTPS之acme.sh申请证书
    AWStats日志分析系统
  • 原文地址:https://www.cnblogs.com/cxscode/p/12750099.html
Copyright © 2011-2022 走看看