打开DataGrip创建一个MySQL数据库
打开数据库的配置
会提示安装驱动,数据库的版本需要与驱动版本一致.
自己在官网下载MySQL驱动.
若不一致,需要下载驱动 http://central.maven.org/maven2/mysql/mysql-connector-java/
Test Connection
若出现问题,查看问题报错,可能是
java.sql.SQLException: The server time zone value ‘Öйú±ê׼ʱ¼ä’ is
unrecognized or represents more than one time zone. You must configure
either the server or JDBC driver (via the serverTimezone configuration
property) to use a more specifc time zone value if you want to utilize
time zone support.
解决方法:
设置整个数据库的时区,可以采用sql来完成:
mysql > show variables like ‘%time_zone%’;
mysql > set global time_zone=’+8:00’;