关于用jdbc访问云数据库mysql Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES)问题

来源:互联网 发布:pushkit java 编辑:程序博客网 时间:2024/06/05 10:36

这个问题表示云服务器上的数据库没有给“xxx.xxx.xxx.xxx”用户访问权限,这时候我们需要进入mysql为用户赋权限:

执行授权命令
mysql> grant all privileges on *.* to root@'%' identified by '123';
Query OK, 0 rows affected (0.07 sec)

上述代码表示给用户名为root的所有用户操作数据库的所有权限

代码这里需要对应上去Connection conn = DriverManager.getConnection(url, "root", "123");



此时我们再尝试访问数据库就成功了

此时我们再尝试访问数据库
阅读全文
0 0
原创粉丝点击