Unable to connect to MariaDB using DBeaver

前端 未结 1 1407
后悔当初
后悔当初 2021-02-06 04:04

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.

1条回答
  •  臣服心动
    2021-02-06 04:27

    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;
    

    0 讨论(0)
提交回复
热议问题