Margherita
Margherita

Reputation: 73

MySQL user password problem

A few months ago I developed a program in C which interacts with a MySQL database and is running on Ubuntu.

Unfortunately I forgot the user's password and now whenever I run the program I get:

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

That's quite strange since the password is correct and it's the root password which obviously doesn't match the word 'yes'..

How can I solve the problem? Thanks.

Upvotes: 2

Views: 381

Answers (2)

a1ex07
a1ex07

Reputation: 37354

You need to login as root (or as another user with sufficient permissions) and then change the password for user user1. You have a few options to alter password (using SET PASSWORD, using GRANT, or issuing update query against mysql.user). Check here for examples.

Upvotes: 1

Arnaud Le Blanc
Arnaud Le Blanc

Reputation: 99909

using password: YES means that you tryied to login using a password (not that you used the password YES)

Try changing the user's password:

UPDATE mysql.user SET Password=PASSWORD('new password') WHERE Name = 'user1';
FLUSH PRIVILEGES;

Upvotes: 2

Related Questions