- 数据库连接不上
解决方案:
数据库连接失败解决方案
再次遇到MySQL8 的连接失败的问题:
报错信息如下:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed
could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
解决方案是:修改一下jdbc的配置信息,
url: jdbc:mysql:///hm49?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: root
password: root
主要就是要在最后添加:
&allowPublicKeyRetrieval=true
2.一直解决不了跨域问题
最终发现是Nginx的配置没有配置api的
具体的配置信息如下:
#乐优商城的代理配置
server {
listen 80;
server_name manage.leyou.com;
location / {
proxy_pass http://127.0.0.1:9001;
proxy_connect_timeout 600;
proxy_read_timeout 600;
}
}
server {
listen 80;
server_name api.leyou.com;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://127.0.0.1:10010;
proxy_connect_timeout 600;
proxy_read_timeout 600;
}
}