NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
[resolved] Problem with Accessing MySQL on cPanel


Joined: 05 Nov 2008
Posts: 2
Location: Australia
Reply with quote
One of my clients is trying to use PHPED to access their MySQL databases remotely and make forms etc.

Basically, they have cPanel Hosting with us to which MySQL usernames are setup as accountusername_mysqldbusername and database names are setup as accountusername_databasename

They are getting an error on trying to connect that states the following:

Code:
"Could not connect using datainfo@xxx.xxx.xxx.xxx
1045 - Access denied for user ‘datainfo’@’xxx-xxx-xx-xx.xxx.xxxx.xxx.x'(using password: YES)"



Note: xxxx means I have removed IP address and hostname details for security purposes.


Could you please tell me why this could be occurring and explain what could be done to resolve it?

We have allowed access through our firewall for the MySQL port and the DB user they have assigned to the DB in cPanel is assigned all privledges.

Any ideas or suggestions are welcome?

Regards,

Dale

_________________
HH
View user's profileFind all posts by hightekhostingSend private messageMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Quote:
Could you please tell me why this could be occurring and explain what could be done to resolve it?
We have allowed access through our firewall for the MySQL port and the DB user they have assigned to the DB in cPanel is assigned all privledges

Please read MySQL manual.
If the server returns this error it means it. Nothing else. Your user account password is wrong. Most probably you granted all the priviledges to a different user while datainfo’@’xxx-xxx-xx-xx.xxx.xxxx.xxx.x' remained unpriveledged.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 05 Nov 2008
Posts: 2
Location: Australia
Reply with quote
The account password is not correct as scripts on the server can connect to the database fine internally using the same username and password.

Privledges are set to GRANT ALL to the database, so I know it is not that.

Please take into account this is a cPanel server.

Any other person using something other than PHPED can connect to the server fine with no hassles at all. It appears only to be this one client having issues using PHPED to connect.

What I am asking for is confirmation as to what PHPED requires it's settings to be, not just to be palmed off.

_________________
HH
View user's profileFind all posts by hightekhostingSend private messageMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Quote:
The account password is not correct as scripts on the server can connect to the database fine internally using the same username and password

scripts on the server CAN NOT use the same user name at least.

Quote:
Privledges are set to GRANT ALL to the database, so I know it is not that.


I know it is that. Please read MySQL manual.

Quote:
What I am asking for is confirmation as to what PHPED requires it's settings to be


PhpED is NOT involved at ALL. All authentication goes between mysql client library and mysql server ONLY. If server tells you that the authentication is not passed it means that user has NO grants. It means that you did NOT issue any grants to that user on the database you are trying to connect to, but issued necessary grants to the user that your scripts are using. Your scripts can not use the same username as PhpED after all because they are running on DIFFERENT hosts. That's MySQL FAQ. RTFM.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 06 Jun 2007
Posts: 289
Location: Vancouver, Canada
Reply with quote
Dmitri is right, this is not a PhpED problem. A Cpanel server uses MySQL like any other web server would. The only thing that is "special", is that you can use the user friendly Cpanel control panel to create your databases and set up your users. From that point further, it's just another web server running PHP and MySQL.

The problem that you are experiencing is most likely that the database is not set up to allow connections from your client's IP addresses. By default, MySQL will allow connections from localhost (the server itself) only, and deny connections from remote IP addresses (such as the computer where PhpED is installed). To fix this, simply log in to your Cpanel and use the Remote MySQL function to add your client's IP address (i.e. the public IP address of the computer where PhpED is installed).

_________________
Smile
View user's profileFind all posts by annoSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Quote:
The problem that you are experiencing is most likely that the database is not set up to allow connections


no, no. If it was the case, he would not get the error message stating Access denied for user ‘datainfo’@’xxx-xxx-xx-xx.xxx.xxxx.xxx.x'

It's ABSOLUTELY clear that he granted rights only to datainfo@localhost or datainfo@127.0.0.1 or whatever local user he granted to, but DID NOT grant to datainfo’@’xxx-xxx-xx-xx.xxx.xxxx.xxx.x and it makes all the difference because mysql treats them as DIFFERENT users and this is CLEARLY described in mysql GRANT command Smile

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 06 Jun 2007
Posts: 289
Location: Vancouver, Canada
Reply with quote
That's exactly what I was trying to say, but I guess it came out wrong Wink

_________________
Smile
View user's profileFind all posts by annoSend private messageVisit poster's website


Joined: 20 Nov 2008
Posts: 6
Reply with quote
I guess a number of issues could have caused this :

- skip-networking in my.cnf
- wrong username used ( cPanel needs user_db as database name )
- last but not least, wrong password
View user's profileFind all posts by bin_ascSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Quote:
I guess a number of issues could have caused this

If you connect to mysql from a php script using USERNAME as account name, the user name in fact will be USERNAME@127.0.0.1
If you connect to mysql from another computer using the same account name, the user name if fact will be USERNAME@<your computer IP>
With mysql authentication system, you can GRANT privileges to USERNAME@%. In this case both ways will work. If you GRANT to USERNAME@127.0.0.1, only local connection will be accepted, while USERNAME@<your computer IP> will be rejected with "wrong password" error message, which is kinda confusing but that's what you can blame mysql at, not phped.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 20 Nov 2008
Posts: 6
Reply with quote
Yep, I was blaming the regular code and server, and not phped Razz
View user's profileFind all posts by bin_ascSend private message
[resolved] Problem with Accessing MySQL on cPanel
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic