Skip to content

Be more specific on detecting mysql socket - #26

Open
stephankn wants to merge 1 commit into
maxhq:masterfrom
stephankn:patch-1
Open

Be more specific on detecting mysql socket#26
stephankn wants to merge 1 commit into
maxhq:masterfrom
stephankn:patch-1

Conversation

@stephankn

Copy link
Copy Markdown

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

maxhq commented Aug 1, 2020

Copy link
Copy Markdown
Owner

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

@ironbishop

Copy link
Copy Markdown

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