Skip to content
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

Be more specific on detecting mysql socket #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stephankn
Copy link

The previous code enumerates lists both listening and connected sockets. The output of listening (-l) is enough for the intended purpose. Optimizing this.

Further on, it matches on the first socket which in my case was mysqlx.sock which leads later to a protocol error. More specific search string resolves this.

As on this situation:

netstat -axn | grep mysql

unix 2 [ ACC ] STREAM LISTENING 1934165 /var/run/mysqld/mysqlx.sock
unix 2 [ ACC ] STREAM LISTENING 1934169 /var/run/mysqld/mysqld.sock
unix 3 [ ] STREAM CONNECTED 1934197 /var/run/mysqld/mysqld.sock
[...]

we had

netstat -axn | grep -m1 mysq

unix 2 [ ACC ] STREAM LISTENING 1934165 /var/run/mysqld/mysqlx.sock

and error
ERROR 2007 (HY000): Protocol mismatch; server version = 11, client version = 10

After the fix it finds the right socket:

netstat -lxn | grep -m1 mysqld.sock

unix 2 [ ACC ] STREAM LISTENING 1934169 /var/run/mysqld/mysqld.sock

The previous code enumerates lists both listening and connected sockets. The output of listening (-l) is enough for the intended purpose. Optimizing this.

Further on, it matches on the first socket which in my case was mysqlx.sock which leads later to a protocol error. More specific search string resolves this.

As on this situation:
# netstat -axn | grep mysql
unix  2      [ ACC ]     STREAM     LISTENING     1934165  /var/run/mysqld/mysqlx.sock
unix  2      [ ACC ]     STREAM     LISTENING     1934169  /var/run/mysqld/mysqld.sock
unix  3      [ ]         STREAM     CONNECTED     1934197  /var/run/mysqld/mysqld.sock
[...]

we had 
# netstat -axn | grep -m1 mysq
unix  2      [ ACC ]     STREAM     LISTENING     1934165  /var/run/mysqld/mysqlx.sock

and error
ERROR 2007 (HY000): Protocol mismatch; server version = 11, client version = 10

After the fix it finds the right socket:
# netstat -lxn | grep -m1 mysqld.sock
unix  2      [ ACC ]     STREAM     LISTENING     1934169  /var/run/mysqld/mysqld.sock
@maxhq
Copy link
Owner

maxhq commented Aug 1, 2020

Hey good find — thank you!
I‘ll check and merge it „as soon as possible“ (tm) :-), together with the other PRs.

@ironbishop
Copy link

i merged this in my branch, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants