Dino Geek, try to help you

How to resolve Access denied for user 'root'@'localhost' error in MariaDB?


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.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use