Georgian
Georgian

Reputation: 8960

C# with MySQL connector - access denied

I have a remote hosted website with a MySQL database.

I am trying to access that database from a small C# program.

What I've tried:

What I'm getting:

What boggles my mind:

LATER EDIT:

LATER LATER EDIT:

I don't have privileges to CREATE USER, nor do I have SSH access via PuTTy or so.
Does this basically mean that it's my hosting's fault that I can't connect from a remote location to the DB?

Upvotes: 2

Views: 7219

Answers (4)

Eric Petroelje
Eric Petroelje

Reputation: 60528

Have a look at the users in your mysql database. A couple things to check:

  1. With cPanel on shared hosting, if you create a user named blah the actual name of the user in mysql is often unixusername_blah. This is done automatically to prevent MySQL user name conflicts between different cPanel accounts sharing the same MySQL server.

  2. With MySQL you can define which hosts a user is allowed to connect from. Is the new user you defined allowed to connect from your IP?

ETA:

Might want to have a look at the permissions for that user account and make sure appropriate permissions are granted. You can do this by running the following in phpMyAdmin or at the console:

SHOW GRANTS FOR 'something_root'@'localhost'

And compare the grants you see there to what you get here:

SHOW GRANTS FOR 'something_root'@'%'

Finally, depending on your hosting environment you may not have permissions to create new users or expand their privileges enough to be able to do this. This would be particularly likely if you have a shared hosting account.

Upvotes: 1

mwaqas
mwaqas

Reputation: 21

reset mysql user password and then try again

http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

Upvotes: 0

Nathan
Nathan

Reputation: 2775

Check if your hosting service allows connecting to its database server from outside its network. Some hosting companies like GoDaddy, by default, don't allow this.

Also, you need to create a database user and assign permissions to it, through your preferred database administration tool.

Upvotes: 1

cesarfaria
cesarfaria

Reputation: 83

How can I find out if my webhosting service allows remote connections?

It's better ask your whebhosting proveder, some allows remote connections, other no. If they allow remote connections you may have to configure which hosts a user is allowed to connect from or, add a wildcard % to allow connections from any host.

Upvotes: 1

Related Questions