Security

ERROR java.sql.SQLException: Access denied for user 'root'@'xx.xx.xxx.xxx' (using password: NO)

gajananh999
Contributor

Dear Everyone,

When i am trying to connect MySQL database from splunk db connect. MySQL is on another server.

Error is

ERROR java.sql.SQLException: Access denied for user 'root'@'xx.xx.xx.xxx' (using password: NO)

Can anyone please help me on this.

Thanks

Gajanan Hiroji.

0 Karma

s_debasish
New Member

If you are connecting a remote mysql server from your local machine using java see the below steps. Error : "java.sql.SQLException: Access denied for user 'xxxxx'@'101.123.163.141' (using password: YES) "

for remote access may be cpanel or others grant the remote access for your local ip address.

In the above error message: "101.123.163.141" is my local machine ip. So First we have to give remote access in the Cpanel-> Remote MySQL®. Then run your application to connect.

Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection(

"jdbc:mysql://www.xyz.com/abc","def","ghi");

//here abc is database name, def is username and ghi

Statement stmt=con.createStatement();

ResultSet rs=stmt.executeQuery("select * from employee");

while(rs.next())

System.out.println(rs.getInt(1)+" "+rs.getString(2)+"

"+rs.getString(3));

con.close();

Hope it will resolve your issue.

Thanks

0 Karma

netxcel
Engager

I am facing similar problem. Have you solved it?

Encountered the following error while trying to save: In handler 'databases': Error connecting to database: java.sql.SQLException: Access denied for user 'root'@'' (using password: YES)

Pls help!!!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Have you granted access to the database? For example, 'grant all privileges on database.* to root@machine.splunk.runs.on;

---
If this reply helps you, Karma would be appreciated.
0 Karma

gajananh999
Contributor

I am trying to connect from one ec2 machine to another ec2 machine

0 Karma

gajananh999
Contributor

Ther was way to add username password.
First i have connected to localhost database using host as 127.0.0.1. now i am trying to connect to 54.35.xx.xxx Mysql database but i m getting this error.

ERROR java.sql.SQLException: Access denied for user 'root'@'50.16.35.xxx' (using password: NO)

In error massage its trying to connect my local machine again because my local machine IP address is 50.16.35.xxx instead of 54.35.xx.xxx

Can anyone please tell me how this is happening.

0 Karma

okrabbe_splunk
Splunk Employee
Splunk Employee

When you added the connection there was no way to enter the username and password?

http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Addadatabaseconnection

0 Karma

gajananh999
Contributor

When i have given different machine IP address to add the database but it is taking local machine and checking the user in local machine.

0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with William Searle

The Splunk Guy: A Developer’s Path from Web to Cloud William is a Splunk Professional Services Consultant with ...

Major Splunk Upgrade – Prepare your Environment for Splunk 10 Now!

Attention App Developers: Test Your Apps with the Splunk 10.0 Beta and Ensure Compatibility Before the ...

Stay Connected: Your Guide to June Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...