dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
http://mycli.net
Other
11.41k stars 658 forks source link

Better error message when unable to connect via socket #572

Open tsroten opened 6 years ago

tsroten commented 6 years ago

Currently, on a Linux system after installing MySQL and mycli, there is a cryptic message displayed when running mycli with the default config:

$ mycli
(2003, "Can't connect to MySQL server on 'localhost' ([Errno 2] No such file or directory)")
Failed to connect by socket, retrying over TCP/IP

The issue itself will be resolved by https://github.com/dbcli/mycli/issues/571, but the error message is unhelpful because it doesn't tell you anything about the socket that was tried. It just tells you the host name, which makes you think there is a problem with your server. Compare that to the official mysql client's message if you connect to a non-existent socket:

$ mysql -S /var/run/mysqld/mysqld.sock
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
jonathanlloyd commented 4 years ago

Hi! I have had a quick go at returning some extra context when failing to connect to the default socket - is this the sort of thing you were looking for? Just printing the path should be enough to help with debugging?