无法使用DBeaver连接到MariaDB [英] Unable to connect to MariaDB using DBeaver

查看:764
本文介绍了无法使用DBeaver连接到MariaDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在Ubuntu 18.04上安装了MariaDB 10.1.29.在命令行中,我可以使用sudo进行连接:

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

但并非没有sudo.

此外,如果我尝试通过 DBeaver 连接到数据库,则会得到:

Also, if I try to connect to the database through DBeaver, I get:

Could not connect: Access denied for user 'root'@'localhost'

虽然凭据正确.我尝试安装MySQL 5.7,但在那里也遇到了完全相同的问题.

While the credentials are correct. I tried installing MySQL 5.7, but I'm experiencing the exact same issue there as well.

我想念什么?

推荐答案

事实证明,这是MariaDB和MySQL的预期行为.为解决此问题,建议创建一个单独的用户并授予对所有创建的数据库的访问权限.这是有关如何使用命令行创建数据库以及如何向所选用户授予权限的分步指南.

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.

$ sudo mysql -u root -p

创建数据库

mysql> CREATE DATABASE `database_name`;

创建用户

mysql> CREATE USER 'user_name' IDENTIFIED BY 'a_secure_password';

授予用户权限

mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'%' WITH GRANT OPTION;

应用更改

mysql> FLUSH PRIVILEGES;

这篇关于无法使用DBeaver连接到MariaDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆