Skip to content

Conversation

danvergara
Copy link
Owner

@danvergara danvergara commented Mar 2, 2023

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@danvergara danvergara marked this pull request as draft March 2, 2023 02:58
@danvergara danvergara marked this pull request as ready for review March 12, 2023 17:20
@danvergara danvergara self-assigned this Mar 12, 2023
@danvergara danvergara added kind/enhancement New feature or request intermediate Good for intermediate developers labels Mar 12, 2023
Copy link

@Carlangueitor Carlangueitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Makefile Outdated
@@ -13,7 +13,7 @@ unit-test:
.PHONY: int-test
## int-test: Runs the integration tests
int-test:
docker-compose run --entrypoint=make dblab test
docker compose run --entrypoint=make dblab test

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I´d like to have this change in other PR rather than put it here on this feature branch.

@danvergara danvergara force-pushed the add-mysql-socket-conn branch from b88bdf1 to e1393a8 Compare March 15, 2023 02:19
@danvergara danvergara force-pushed the add-mysql-socket-conn branch from e1393a8 to 2ca392c Compare March 15, 2023 02:58
@danvergara danvergara merged commit 4897dfe into main Mar 15, 2023
@danvergara danvergara deleted the add-mysql-socket-conn branch March 15, 2023 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intermediate Good for intermediate developers kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support MySQL / MariaDB Sockets
2 participants