Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

ERROR 1045 (28000): Access denied for user 'mahi'@'localhost' (using password: YES)

avatar

I have added one user (mahi) & password is set 'hadoop' for that...also give privileges for that...but still it is not login ...give this error...could anyone give me solution for same.

Create user mahi identified by 'hadoop';

grant all on malpute.* to mahi;

Thanks

Mahendra

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Mahendra Malpute

The following error indicates that the database that you are trying to connect using "mahi" credentials is wither not correct or The Database is not correct.

ERROR 1045 (28000): Access denied for user 'mahi'@'localhost' (using password: YES)

.

Try this:

GRANT ALL PRIVILEGES ON *.* TO 'mahi'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'mahi'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'mahi'@'<DATABASE_FQDN>';
FLUSH PRIVILEGES;

.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@Mahendra Malpute

The following error indicates that the database that you are trying to connect using "mahi" credentials is wither not correct or The Database is not correct.

ERROR 1045 (28000): Access denied for user 'mahi'@'localhost' (using password: YES)

.

Try this:

GRANT ALL PRIVILEGES ON *.* TO 'mahi'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'mahi'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'mahi'@'<DATABASE_FQDN>';
FLUSH PRIVILEGES;

.

avatar

Hello @Jay SenSharma

I I have given grant to that user, but still I am getting same error.Also I checked credential is right.

#mysql -u mahi -p hadoop

Please help me for this issue.

Thanks

Mahendra

avatar
Master Mentor

@Mahendra More

If the user "mahi" does not have access to "mysql" database (Which is the default Database) then you will get the same error when using t he following command.

# mysql -u mahi -p hadoop

.

You have two options.

1. Grant "mahi" user to access "mysql" (default Database)

OR

2. You should provide database name on which the "mahi" user has access. (If you want to login to any specific database)

Example:

# mysql -u mahi -p mahiDatabaseName
Enter password: hadoop

avatar

Thanks @Jay SenSharma

Finally login from that user without enter password. If enter passpword then still it is giving error.I don't know why this happend in mysql.But anyways . all is done.

# mysql -u mahi

Again thanks for helping.

avatar
Rising Star

Check users info in mysql.user.

mysql> select User,Password,Host from mysql.user;

Normally, create user DDL pattern is like this below.

CREATE USER 'peter'@'localhost' IDENTFIED BY 'password';

GRANT ALL PRIGILEGES ON *.* TO 'peter'@'localhost';

CREATE USER 'peter'@'fqdn' IDENTFIED BY 'password';

GRANT ALL PRIGILEGES ON *.* TO 'peter'@'fqdn';

CREATE USER 'peter'@'%' IDENTFIED BY 'password';

GRANT ALL PRIGILEGES ON *.* TO 'peter'@'%';

FLUSH PRIVILEGES;