-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
try more default socket paths #795
Conversation
Is this ready for a merge? |
Not quite: it works on the distributions from the table, but I still have not gotten to inspecting other distributions, and, more importantly, other DBs like MariaDB (they may name sockets differently). By the way, does anyone have access to a MacOS system? What is the MySQL socket path there? |
mycli/packages/filepaths.py
Outdated
@@ -3,11 +3,13 @@ | |||
from mycli.encodingutils import text_type | |||
import os | |||
|
|||
DEFAULT_SOCKET_DIRS = ('/var/run/', '/var/lib/', '/tmp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/tmp
might not be such a good idea; on a multi-user system anyone might create a socket in this directory to intercept passwords...
I like this change because it will help a common problem experienced by our users. If we support multiple socket locations we should inform the user which location was chosen, especially when there are actually multiple socket locations available. |
@pasenor I'm on macOs and it is
|
OK then, let's add |
That would be fine for me, another posibility would be to check the owner of the socket (root? mysql?) |
I'm seeing an error when I launch mycli with no arguments or options. Stacktrace from the log file:
|
My guess would be that we found a socket (a wrong one), connected to it, but now it is sending garbage. Is it likely to happen in your setup (i.e. do you have multiple socket candidates)? I'll try to reproduce the situation and push a workaround. Also, we only echo the socket location after a successful connect, probably better to do it earlier. |
016badc
to
d70ce56
Compare
i looked into it again and found another problem: while reading the With this fixed, the guessing function should only be called as a last resort in case our user is not allowed to read configs. @amjith can you check if your error still happens? I have not been able to reproduce it, but If the cause was mycli finding the wrong socket it may be fixed now. |
d70ce56
to
a3cf82a
Compare
Codecov Report
@@ Coverage Diff @@
## master #795 +/- ##
==========================================
- Coverage 79.70% 79.41% -0.29%
==========================================
Files 23 23
Lines 1754 1793 +39
==========================================
+ Hits 1398 1424 +26
- Misses 356 369 +13
Continue to review full report at Codecov.
|
Works well. Thank you! 🏎️ |
Description
Issue #794
If the socket path is not specified, try to find a file by the name mask
mysql*.socket
in different locations.I wonder if we should move
DEFAULT_SOCKET_DIRS
from code to.myclirc
, so it can be configured for different distributions.WIP: test and collect more data on where the default socket may be placed in different OS.
Checklist
changelog.md
.AUTHORS
file (or it's already there).