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 pass开发者_如何学Pythonword which obviously doesn't match the word 'yes'..
How can I solve the problem? Thanks.
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;
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.
精彩评论