美文网首页
Could not get JDBC Connection错误

Could not get JDBC Connection错误

作者: mejhwu | 来源:发表于2018-01-11 14:31 被阅读0次

查找原因

  1. 数据库连接url是否正确?
  2. 用户名密码是否正确?
  3. MySQL是否允许远程访问?

MySQL允许远程访问方法

  1. 修改user表
mysql -u root –p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
  1. 授权
//1.允许root用户从任何主机使用密码123456登录
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

//2.允许someone用户使用密码123456从10.10.50.127登录
mysql>GRANT ALL PRIVILEGES ON *.* TO 'someone'@’10.10.50.127’ IDENTIFIED BY '123456' WITH GRANT OPTION;

//3.赋予任何主机访问数据的权限
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

//刷新
mysql>FLUSH RIVILEGES;

相关文章

网友评论

      本文标题:Could not get JDBC Connection错误

      本文链接:https://www.haomeiwen.com/subject/jdoznxtx.html