Unable to establish a connection with DB using HeidiSQL

[expired user #4447]'s profile image [expired user #4447] posted 15 years ago in Creating a connection Permalink
Hello All..

I am using HeidiSQL for making a connection to my online DB. The problem is this, It shows an error in alert box :-

Could not establish connection! Details.
SQL Error! Access denied for user '*********'@'*********' (Some username and password) (using password:yes)


I know that my username and password is valid and correct. But still no luck.. :(

One more thing that when i make connection with DB at(http://localhost/phpmyadmin/, XAMPP) on my local machine it connects successfully. But when try to make connection online it prompts error message.

Additional Info. (I am using Port:3306 and Session: Shivbaba Infotech for online connection with DB).

Any help will be appreciated...
regards
Rishi
[expired user #4447]'s profile image [expired user #4447] posted 15 years ago Permalink
Hello All..

I am using HeidiSQL for making a connection to my online DB. The problem is this, It shows an error in alert box :-

Could not establish connection! Details.
SQL Error! Access denied for user '*********'@'*********' (Some username and password) using password:yes


I know that my username and password is valid and correct. But still no luck.. :(

One more thing that when i make connection with DB at(http://localhost/phpmyadmin/, XAMPP) on my local machine it connects successfully. But when try to make connection online it prompts error message.

Additional Info. (I am using Port:3306 and Session: Shivbaba Infotech for online connection with DB).

Any help will be appreciated...
regards
Rishi
[expired user #4449]'s profile image [expired user #4449] posted 15 years ago Permalink
You must understand MySQL security First:

root@% mean a user from any machine
root@localhost mean a user from localhost
root@othermachine mean a user from othermachine

so when you get: Access denied for user 'root@othermachine' using password:yes

check privileges using phpmyadmin if user root@othermachine or root@% exist if donĀ“t you must create user exactly as shown.

This solution apply to all clients not only to HeidiSQL.

I hope this can help you...
[expired user #4447]'s profile image [expired user #4447] posted 15 years ago Permalink
Thanks for Replying...

Can you please explain me, when HeidiSQL connection window for DB is open which username/password is to use. Will it be of FTP or will it be of Database username/password.?

I am sure that it will be of Database username/password. Can you please confirm. I am little confused.

Thanks in advance...
ansgar's profile image ansgar posted 15 years ago Permalink
Sure it's the database user/pass. smile
[expired user #4447]'s profile image [expired user #4447] posted 15 years ago Permalink
Hi, thanks for replying.

But i didn't understand one thing if i am putting all the valid DB connection details. Then why its prompting me following:-

Sql Error: Access denied for the user 'Username''@''My System IP Address' (Using Password: Yes)

What is wrong in it. I am 101% sure that my DB details are perfect. But still unable to connect DB using HeidiSQL. Do i need to set some of PHPMyadmin Settings.?

Needed Help. Thanks in Advance..
[expired user #4447]'s profile image [expired user #4447] posted 15 years ago Permalink
Some details i am providing which i am using to make DB connection:-

Session: Shivbaba Infotech (Can i use any name.?)
Hostname/Ip: http://www.shivbabainfotech.com/
Username : Any Username (Of DB)
Password : Any Password (Of DB)
Port : 3306
Database : Any Database Name

Please prompt me if i am putting any invalid information.
[expired user #4449]'s profile image [expired user #4449] posted 15 years ago Permalink
PHPMyadmin is another mysql client, normally installed on same machine where mysql is running. So you can login without problems. What I said before is that using phpmyadmin to check privileges of 'Username''@''My System IP Address' if don't exist you must create that user an carefully set same password.
ansgar's profile image ansgar posted 15 years ago Permalink

Session: Shivbaba Infotech (Can i use any name.?)

Sure, any name is fine, doesn't matter too much, as it's just the folder name in your registry where stuff is saved.

Hostname/Ip: http://www.shivbabainfotech.com/

That's not a valid hostname - remove that http please.

Username : Any Username (Of DB)

As ramsore says: PHPmyadmin normally does not run on your localhost, so you probably need a different username/password which is allowed to connect from your client IP address.
[expired user #4456]'s profile image [expired user #4456] posted 15 years ago Permalink
Buddy, i am not sure if I am too late, but this is what you need to do. Go to phpMyAdmin and do this
select host, user from mysql.user;
most likely you will get something like this:
+-----------------------+------------+
| host | user |
+-----------------------+------------+
| % | someuser |
| 127.0.0.1 | root |
| BIHAC | root |
| localhost | root |
+-----------------------+------------+
4 rows in set (0.00 sec)

well the % sign means ANY MACHINE (IP ADDRESS) so if you have no users with % as a host, then you cannot connect to that server. If that is the case, then do following:

create user 'heidi'@'%' identified by 'heidiPassword';
grant all on *.* to 'heidi'@'%';
With this user you can connect from any host (computer).
More on this: http://dev.mysql.com/doc/refman/5.1/en/adding-users.html
[expired user #4456]'s profile image [expired user #4456] posted 15 years ago Permalink
Please disregard the line:
| BIHAC | root |

BIHAC is the name of my server!!!
[expired user #4447]'s profile image [expired user #4447] posted 15 years ago Permalink
Okk, and thanks for replying. I will run the above Mysql Queries at home. Because right now i am in office.smile
[expired user #4456]'s profile image [expired user #4456] posted 15 years ago Permalink
Well, any good???
[expired user #4447]'s profile image [expired user #4447] posted 15 years ago Permalink
Yes Yes i am here.

Thanks buddy this works as wonder. Really now i get the access of My DB through HeidiSQL. I executed the above quries and it creates me new username with all the required permissions.

Now i understand what you guys were saying to me... :D

Great Job And Big Thanks To All Of You And Please Don't Go Anywhere. I will need your help for other features of HeidiSQL.

Big Thanks Again...
[expired user #4456]'s profile image [expired user #4456] posted 15 years ago Permalink
Well, any good???
[expired user #4456]'s profile image [expired user #4456] posted 15 years ago Permalink
I am sorry for repeated: Well, any good???

This morning I just refreshed the page, and it appeared again...

I am glad it worked OK, in the begginging I had the same problem, and I resolved it this way... The answers I used to get were quite often similar to:
*It doesn't work on remote machines!!!
*It doesn't work if the MySQL server is on Linux!!!
*It doesn't work ...

So I decided to prove them all wrong, and made it work, also I remembered what I did (of course, I shortened it to only needed steps) and you got your answer. I hope many others did as well...
Peace 'n' God bless!
ansgar's profile image ansgar posted 15 years ago Permalink
That refresh problem should be fixed now, you'll be redirected after posting something.
[expired user #4447]'s profile image [expired user #4447] posted 15 years ago Permalink
Yes, Your post will really be helpful for many other guys suffering from the same issue.

Please login to leave a reply, or register at first.