question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Access denied' to jdbc:mariadb socket connection in DBeaver. OK from shell.

See original GitHub issue

I’ve got MariaDB 10.2.12 installed on linux.

It’s set up for socket access,

	ls -al /var/run/mariadb/mariadb.sock
		srwxrwxrwx 1 mysql mysql 0 Jan  6 12:19 /var/run/mariadb/mariadb.sock=

Via shell, socket connection works perfectly,

	mysql -h localhost -u root -D mysql
		Reading table information for completion of table and column names
		You can turn off this feature to get a quicker startup with -A

		Welcome to the MariaDB monitor.  Commands end with ; or \g.
		Your MariaDB connection id is 1371
		Server version: 10.2.12-MariaDB-log Source distribution

		Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

		Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

		MariaDB [mysql]>

I’m trying to get a socket connection to it using DBeaver 4.3.2 GUI.

I’ve got JDK 1.8 installed

	java -version
		OpenJDK Runtime Environment (IcedTea 3.6.0) (build 1.8.0_151-b12 suse-281.2-x86_64)
		OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

I grabbed latest MariaDB Connector-j,

	ls -al /root/.dbeaver-drivers/maven/maven-central/org.mariadb.jdbc/mariadb-java-client-2.2.1.jar
		-rw-r--r-- 1 root root 553K Dec 22 03:48 /root/.dbeaver-drivers/maven/maven-central/org.mariadb.jdbc/mariadb-java-client-2.2.1.jar

In Dbeaver, I have a DB connection defined:

	@Database connection settings ->
		Server Host: localhost
		Port: 3306
		Database: mysql
		User name: root
		Password: xxxxxxxx

		Local Client: /usr/local/mariadb
		Driver Name: MariaDB

	@Database connection settings -> Edit Driver Settings
		Driver Name: MariaDB Driver       Type: MySQL
		ClassName: org.mariadb.jdbc.Driver
		URL Template: jdbc:mariadb://localhost:3306/mysql?socket=/var/run/mariadb/mariadb.sock
		DefaultPort: 3306       [ ] Embedded

		Libraries
			/root/.dbeaver-drivers/maven/maven-central/org.mariadb.jdbc/mariadb-java-client-2.2.1.jar

But when I try to access the connection, I just get:

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

What am I missing in my DBeaver config?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
catalin560commented, Mar 6, 2020

its 2020, I’m on linux mint, dbeaver community version 7 and this bullshit is still unresolved even by trying the stuff above… why the frickin hell do I have to go through debugging this stuff right after installing mariadb???

2reactions
ahenry2commented, Jan 10, 2018

After a little digging, it’s not

localSocket = true

It’s

localSocket = /var/lib/mariadb/mariadb.sock

fyi

https://mariadb.com/kb/en/library/about-mariadb-connector-j/

localSocket
	Permits connecting to the database via Unix domain socket, if the server allows it.The value is the path of Unix domain socket (i.e "socket" database parameter : select @@socket) .since 1.1.4

Once that’s changed, I get a connection.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot connect to MariaDB instance from Dbeaver using ...
Is it because of some password hashing algorithms mismatch between DBeaver and MariaDB's instance? How do I fix this and connect successfuly?
Read more >
How to enable Remote access to your MariaDB/MySQL ...
By default, MariaDB allows connection only from localhost, all connections from a remote server are denied by default. The first thing you need ......
Read more >
Cannot get connection for URL jdbc:mysql - Access denied
Hi,. I connect locally with a Database with VPN. Test connector is OK. TestConnection But when I try a SELECT, connection error appears:....
Read more >
How to connect to a remote MySQL database with DBeaver
Connecting DBeaver to your server​​ The first thing you must do is have your MySQL configured to allow remote connections. I've already covered ......
Read more >
Security, Identity, & Compliance – AWS Database Blog
To use an SSL connection over JDBC, you must create a keystore, and trust the Amazon RDS root CA certificate.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found