[debian-mysql] Bug#842011: Bug#842011: Bug#842011: default-mysql-client forces removal of mysql-server* and mysql-client*
Clint Byrum
spamaps at debian.org
Wed Oct 26 02:43:53 UTC 2016
Excerpts from Craig Sanders's message of 2016-10-26 12:56:43 +1100:
> On Tue, Oct 25, 2016 at 06:42:11AM -0700, Lars Tangvald wrote:
>
> > SysV and upstart scripts use mysqladmin (which is in the client) to verify
> > that the server is running. 5.7 has some inbuilt support for systemd, so for
> > systemd at least it's not needed.
>
> pgrep (or even telnet to port 3306) would probably be better.
>
> but neither of those are Essential, and neither is netstat, so to avoid
> another dependency, using bash's /dev/tcp built-in would probably be better.
> mysql's init.d script is already bash rather than sh, and this is a bash
> feature which has existed since version 2.04 (although it was disabled in
> debian until around 2009 IIRC)
>
> some google results on the topic:
>
> http://hacktux.com/bash/socket
> http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
>
> probably don't need to get a meaningfule result, just check to see there's
> something listening on port 3306 (or whatever's defined in my.cnf)
>
> #! /bin/bash
>
> ( exec 3<>/dev/tcp/localhost/3306 ) >& /dev/null
> echo $?
>
> wrapped in a subshell to avoid spamming stderr if nothing's listening.
That seems like a gross oversimplification of what works extremely well
today. mysqladmin actually understands mysql's protocol, and can verify
that it is up and fully functional. Listening doesn't mean responding,
or ready for clients.
One would hope mariadb's client package provides a similar thing, and
maybe we could just depend on the virtual package.
More information about the pkg-mysql-maint
mailing list