danvergara / dblab

The database client every command line junkie deserves.
MIT License
2.4k stars 63 forks source link

Add mysql socket conn #149

Closed danvergara closed 1 year ago

danvergara commented 1 year ago

Description

This PR adds a new way to connect to MySQL through Unix Sockets. Therefore the --socket flag was added.

# URL option
$ dblab --url "mysql://user:pasword@unix(/path/to/socket/mysql.sock)/dbname?charset=utf8"

# Socket flag
$ dblab --socket /path/to/socket/mysql.sock --user user --db dbname --pass password --ssl disable --port 5432 --driver mysql --limit 50

Fixes #125

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Followed this guide to install MySQL/MariaDB on my local system.

Inspected the /etc/my.cnf.d/community-mysql-server.cnf config file to see where the socket file was.

[mysqld]
socket=/var/lib/mysql/mysql.sock

Then, I managed to connect to MySQL through that socket file as expected.

Screenshot from 2023-03-12 11-18-49

Checklist: