`

java.sql.SQLException: Access denied for user ''@'localhost' (using pass word: Y

 
阅读更多
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
 

说明:

grant all privileges on *.* to 'username '@'% ' identified by 'password ';

all 指定相关操作

*.* 说明数据库和表名

username 表示用户名

% 这里是 Host 名称,允许所有的就用 %

Password 表示密码

分享到:
评论
1 楼 my520530 2012-04-10  
出现那个问题不是连接mysql的用户名和密码不对么?

相关推荐

Global site tag (gtag.js) - Google Analytics