Link to home
Start Free TrialLog in
Avatar of sybe
sybe

asked on

Access denied for user 'username'@'localhost' (using password: YES)

I have to move a website built in ASP.Net 1.0 to another server. I have no physical access to that server and I do not know the root password for MySql.

The database has been mkoved, and I can login on phpadmin with username/password and see, edit the database. However, when using the same username/password in the connectionstring in the application it gives the error

"Access denied for user 'username'@'localhost' (using password: YES)"

The connectionstring used is:
UID=username;DATABASE=databasename;DRIVER=MySQL ODBC 3.51 Driver;PWD=password;OPTION=0;SERVER=localhost

The complete error message is:
System.Data.Odbc.OdbcException: ERROR [HY000] [MySQL][ODBC 3.51 Driver]Access denied for user 'username'@'localhost' (using password: YES) ERROR [HY000] [MySQL][ODBC 3.51 Driver]Access denied for user 'username'@'localhost' (using password: YES)

How should this be solved?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

> I have no physical access to that server and I do not know the root password for MySql.

you will have to ask the "root" / db admin the relevant permissions.
you cannot solve that from outside...

note that "localhost" refers to the host itself, you must put in the "remote" mysql host ...
Avatar of sybe
sybe

ASKER

> you will have to ask the "root" / db admin the relevant permissions.
> you cannot solve that from outside...

I can ask the db admin to do something. But I do not know what he should do. And he does not know either.

> note that "localhost" refers to the host itself, you must put in the "remote" mysql host

It means that the db server is same machine as the webserver. And that seems to be the case.
>And he does not know either.
huh?
he does not know how to grant a username some permissions to a database?????


>It means that the db server is same machine as the webserver. And that seems to be the case.
yes, that's fine
Avatar of sybe

ASKER

> he does not know how to grant a username some permissions to a database?

Because db admin is maybe a big word in this case. It seems he's waiting for me to tell him what to do. But my experience with MySQL is minimal.

I found this somewhere (to be done as MySQL root)

GRANT ALL PRIVILEGES ON database_name TO user@host IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Should that solve it?
Avatar of sybe

ASKER

thnx, I am mailing the db admin.

It leaves me wondering how /phpadmin can work with the same username/password, but the website (which is approached on the same domain) does not?
ASKER CERTIFIED SOLUTION
Avatar of Ferrosti
Ferrosti
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sybe

ASKER

Well, the homepage of phpadmin says this:

Server: localhost via TCP/IP
User: username@localhost

Avatar of sybe

ASKER

Ok, so now I see what happened.

The db admin changed the password subtly just before giving me access to phpadmin. One character changed from uppercase to lowercase and I did not see the difference. The db admin also did not explicitly say the password had changed.

However, I logged in into phpadmin with the new password which was send to me together with the link to phpadmin, and the connectionstring still had the old password.

Updating the password in the connectionstring to the new one, solved the problem.

Thanks for thinking with me.