用户'user'@'localhost'的访问被拒绝(使用密码:是) [英] Access denied for user 'user'@'localhost' (using password: yes)

查看:320
本文介绍了用户'user'@'localhost'的访问被拒绝(使用密码:是)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然发现了与此问题相关的太多问题.

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/phpmyadminMySQL 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'的访问被拒绝(使用密码:是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆