原创

连接数据库存在的字符编码异常 jdbc The server time zone value ...

温馨提示:
本文最后更新于 2019年04月20日,已超过 2,037 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

直接上异常


2019-02-26 13:01:16.204 DEBUG 18856 --- [http-nio-9091-exec-6] o.s.web.servlet.DispatcherServlet        :
Failed to complete request: org.springframework.jdbc.CannotGetJdbcConnectionException: 
Failed to obtain JDBC Connection; nested exception is 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.

话不多说,从错误即可知道是时区的错误,因此只要将时区设置为你当前系统时区即可,

因此使用root用户登录mysql,按照如下图所示操作即可。

Host 'xxx' is not allowed to connect to this MySQL server.

你想root使用mypassword从任何主机连接到mysql服务器的话。 
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 


如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码 
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY 
'mypassword' WITH GRANT OPTION; 
输入命令mysql> FLUSH PRIVILEGES; 回车使刚才的修改生效,再次远程连接数据库成功。bingo.
别忘记最后的FLUSH PRIVILEGES; 刷新先前的修改。
正文到此结束
本文目录