问题描述
我仍然发现了与此问题相关的太多问题.
I'd found too many questions related to this problem still I'm having the same problem.
我已经从 MYSQL :: Download MYSQL Installer 安装了MySQL Server
.另外,我在localhost
上运行了xampp
.
I've installed MySQL Server
from MYSQL::Download MYSQL Installer. Also, I've running xampp
on my localhost
.
http://localhost/phpmyadmin
和MySQL Command Line Client
正常工作,我能够登录并执行SQL
查询.但是问题是,如果我使用jdbc
连接到MySQL
,那么错误就会出现Access denied for 'root'@'localhost' (using password:yes)
.
我用于jdbc的连接字符串是
http://localhost/phpmyadmin
and MySQL Command Line Client
are working fine and I'm able to login as well as execute SQL
queries. But the problem is, if I'm using jdbc
to connect to MySQL
then the error comes Access denied for 'root'@'localhost' (using password:yes)
.
The connection string I'm using for jdbc is
DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root", "root");
但是它不起作用.我尝试删除端口号(3306),仍然是同样的问题.
我还尝试启动用安装程序安装的MySQL Workbench
,并得到相同的连接错误.
but it's not working. I tried removing the port number (3306), still the same problem.
I also tried to start MySQL Workbench
installed with the installer and getting the same error for connection.
有人可以帮助吗? phpmyadmin
工作正常,我能够从php
程序运行sql查询.但是java
不能正常工作.
If anybody could help? phpmyadmin
working fine and I'm able to run sql queries from a php
program. But its not working fine with java
.
推荐答案
尝试授予特权:-
mysql> GRANT ALL PRIVILEGES ON *. * TO root@localhost
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
这篇关于用户'user'@'localhost'的访问被拒绝(使用密码:是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!