Unable to connect to MariaDB using DBeaver
11,262
As it turns out, this is expected behaviour for MariaDB and MySQL. To overcome the issue, it is advisable to create a separate user and grant access to all databases created. Here is a step by step guide on how to create databases using the command line and grant permissions to the user of your choice.
Log in to MariaDB/MySQL
$ sudo mysql -u root -p
Create a database
mysql> CREATE DATABASE `database_name`;
Create a user
mysql> CREATE USER 'user_name' IDENTIFIED BY 'a_secure_password';
Grant user permissions
mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'%' WITH GRANT OPTION;
Apply changes
mysql> FLUSH PRIVILEGES;
Author by
wout
Artist/Developer. Founder of Tili.Gallery and original author of SVG.js.
Updated on June 14, 2022Comments
-
wout almost 2 years
I just installed MariaDB 10.1.29 on Ubuntu 18.04. From the command line I can connect using sudo:
sudo mysql -u root -p
But not without sudo.
Also, if I try to connect to the database through DBeaver, I get:
Could not connect: Access denied for user 'root'@'localhost'
While the credentials are correct. I tried installing MySQL 5.7, but I'm experiencing the exact same issue there as well.
What am I missing?
-
Dawoodjee almost 5 yearsThis worked for me after struggling for a long time. @wout Please mark your answer as the solution.
-
wout almost 5 years@Dawoodjee Great to hear I could help. I did not know I could mark my own answer as the solution ;)
-
Schroter Michael over 3 yearsHi, How do I follow these steps when I already have a existing database? Please let me know. Thanks & Best Regards Michael
-
dehidehidehi over 2 yearsThis worked, thank you so much!