现在的位置: 首页 > 综合 > 正文

java.sql.SQLException: Access denied for user ‘root’@'localhost’ (using password: YES)

2013年01月21日 ⁄ 综合 ⁄ 共 409字 ⁄ 字号 评论关闭

sql:

C:\>mysql -u root -p  
Enter password: ******  
Welcome to the MySQL monitor.  Commands end with ; or \g.  
Your MySQL connection id is 2  
Server version: 5.1.22-rc-community-log MySQL Community Server (GPL)  

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.  

mysql> grant all privileges on *.* to 'username'@'%' identified  by'password';  
Query OK, 0 rows affected (0.05 sec)  

mysql> flush privileges;  
Query OK, 0 rows affected (0.06 sec)  

mysql> exit  
Bye  

更好的解决还是更改用户名,不要用root为善。

抱歉!评论已关闭.