FreeKB - mySQL / MariaDB Resolve "1045 (28000): Access denied for user username@localhost (using password: YES)"
mySQL / MariaDB - Resolve "1045 (28000): Access denied for user username@localhost (using password: YES)"

When attempting to connect to MySQL or MariaDB, error 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES) appears. 

Issue the following command.

mysql -u root

 

Update the password using one of the following commands

UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';

UPDATE mysql.user SET authentication_string=PASSWORD('password')  WHERE  User='root';

 

Issue the following command.

FLUSH PRIVILEGES;

 

Follow these steps if you are still unable to connect to MariaDB with commands such as mysql, mysql -u root, and mysql -u root -p.

The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to stop mariadb.

systemctl stop mariadb
systemctl status mariadb

 

If your system is using init, use the chkconfig and service commands to stop mariadb.

service mariadb stop
service mariadb status

 

Issue the following command.

mysqld_safe --skip-grant-tables &

 

There will be a flashing cursor. Enter the following commands.

mysql -u root

 

At the mysql prompt, issue the following commands.

mysql> use mysql;
mysql> update user set password=PASSWORD("new-password") where User='root';
mysql> exit

 

Now try to log into MariaDB with the following command.

mysql -u root -p

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 4c626 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |