Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Solved Go to solution

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

New Contributor

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

Accepted Solutions

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

Super 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;

.

5 REPLIES 5

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

Super 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;

.

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

New Contributor

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

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

Super 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

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

New Contributor

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.

Highlighted

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

New Contributor

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;

Don't have an account?
Coming from Hortonworks? Activate your account here