mysql 安装

安装参考https://www.cnblogs.com/ayyl/p/5978418.html

mysql 百度网盘下载地址  包括版本 5.7.258.0.14 )

 链接:https://pan.baidu.com/s/1zbNZ1p-H6_QuTwVXCnmz4A

提取码:4efi

 

mysql 安装时出现:one more product requirements have not been satisified 解决办法

原因是有可能是 mysql 依赖环境没有安装好

第一,点击 no

第二,点击 execute ,正常会弹出安装插件的窗口,安装即可,然后

第三,继续 next 安装就行了

 

问题:mysql5.7.1.16 出现 [Err] 1146 - Table 'performance_schema.session_status' doesn't exist

原因:是 mysql 版本问题,需要更新一下

方法:

  1.打开 cmd,进入 mysql 的安装目录下的bin目录下。

  2. 执行 mysql_upgrade -u root -p --force 命令然后输入 password,问题解决。

 

问题:连接 mysql 运行报错 The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone

原因:systemsql 默认美国时间,而我们中国要比他们早 8 小时

方法: 使用 root 用户登录 mysql

 

          show variables like '%time_zone%';

 

    

             因此,采用 +8:00 格式   

        set global time_zone='+8:00';

 

1.版本高  mysql-connector-java 6  所以 application.properties   中需要指定时区serverTimezone:

   在设定时区的时候,如果设定 serverTimezone=UTC,会比中国时间早8个小时,如果在中国,可以选择 Asia/Shanghai 或者 Asia/Hongkong

spring.jpa.show-sql=true

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver    // mysql-connector-java 6 及以上 要加上  .cj
spring.datasource.url=jdbc:mysql://localhost:3306/teacherdata?serverTimezone=Shanghai&useUnicode=true&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root

mybatis.typeAliasesPackage=com.jlau.domain
mybatis.mapperLocations=classpath:mapper/*.xml

pom.xml

<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <scope>runtime</scope>
</dependency>

2.版本低     mysql-connector-java 5

spring.jpa.show-sql=true

spring.datasource.driver-class-name=com.mysql.jdbc.Driver      // mysql-connector-java 5   不需要  .cj
spring.datasource.url=jdbc:mysql://localhost:3306/teacherdata?useUnicode=true&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root

mybatis.typeAliasesPackage=com.jlau.domain
mybatis.mapperLocations=classpath:mapper/*.xml

pom.xml 中写上版本号

<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>5.1.34</version>
   <scope>runtime</scope>
</dependency>

 

 

 

posted @ 2019-01-04 10:01  GGGG6666  阅读(572)  评论(0编辑  收藏  举报