This error generally means that you are trying to connect to your MariaDB server, but you are denied permission. MariaDB uses a protocol called “Unix Socket” for local data transfers.
Follow the steps below to resolve this error:
1. First of all, stop the MariaDB server. The command to stop the MariaDB server depends on your operating system. If you’re using Ubuntu, for example, use the following command: sudo systemctl stop mariadb
1. After you have stopped the server, you should start it again with the skip-grant-tables option, which allows you to connect without a password and with all privileges. Again, the command depends on your OS. For Ubuntu, use the command: sudo mysqld\_safe —skip-grant-tables —skip-networking &
(Note: Adding the ampersand at the end will cause this process to run in the background, freeing up your terminal for further use.)
1. Login to MariaDB as root:
mariadb -uroot
1. At the MariaDB prompt, reset the password. To do this, use the following commands:
- USE mysql;
- UPDATE user SET password=PASSWORD WHERE User=‘root’;
- FLUSH PRIVILEGES;
- exit;
Replace “NEW\_PASSWORD” with your new desired password.
1. Stop and start the MariaDB service again.
1. Now you can log in with your new password:
mariadb -u root -p
Enter the new password when prompted, and you will be granted access.
Remember to ensure MariaDB is secure. Running MariaDB with the —skip-grant-tables option is highly insecure, and should be used with caution.