Dino Geek, try to help you

How to resolve Error 1045 (28000): Access denied for user 'root'@'localhost' in MariaDB?


To resolve the mentioned error in MariaDB, you need to reset the root password. Here are the steps:

Step 1: Stop the MariaDB service.

Depending on which system you use, execute one of the following commands:

- For Debian/Ubuntu: \`\`\` sudo service mysql stop \`\`\`

- For RHEL/CentOS: \`\`\` sudo systemctl stop mariadb \`\`\`

Step 2: Start MariaDB in Safe Mode. This command allows you to login without password:

```
sudo mysqld_safe —skip-grant-tables —skip-networking &
```

Step 3: Connect to the MariaDB server:
```
mysql -u root
```

Step 4: Reset password.

In the MariaDB shell, execute the following commands:

```
use mysql;
UPDATE user SET password=PASSWORD WHERE User=‘root’;
flush privileges;
exit;
```

Replace ‘new-password’ with your desired password.

Step 5: Restart MariaDB service.

- For Debian/Ubuntu: \`\`\` sudo service mysql restart \`\`\`

- For RHEL/CentOS: \`\`\` sudo systemctl start mariadb \`\`\`

Now you should be able to login to MariaDB with your new password.

If the above does not work, you may need to replace `password` column with `authentication_string`. It might vary depending on the version of your MariaDB/MySQL.

Always remember to replace ‘new-password’ with your actual new password in above commands.


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