When attempting to connect to MySQL or MariaDB, error 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES) appears.
- In Tereminal, type 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';
- FLUSH PRIVILEGES;
Follow these steps if you are unable to connect to MariaDB with commands such as mysql, mysql -u root, and mysql -u root -p.
- In Terminal, type /sbin/service mariadb stop
- Type mysqld_safe --skip-grant-tables &
- There will be a flashing cursor. Type mysql -u root
- Type use mysql;
- Type update user set password=PASSWORD("new-password") where User='root';
- Type exit
- Now try to log into MariaDB with the command mysql -u root -p;