1

Sometimes on docker entrypoint files I need to detect whether the database layer is either mysql or mariadb in order to provide the correct configuration for my application whilst I develop docker images for them, specifically the moodle application (even though either mariadb or mysql are practically the same, moodle needs to specify arbitrarily whether the database layer is mysql or mariadb).

So in order to avoid installing lots of dependencies or even extra php code I would love if I could just use the netcat in order to connect to the database and find out whether the database layer is mysql or mariadb.

In my case I only need to just authenticate and from messages to detect whether the database layer is mysql or madb from the messages, so full spec protocol is not necessary just the enough stuff.

Do you know how I can do that?

  • Did you try this before asking? nc <ip_of_sql_server> 3306 should return a "version string". A quick test gave me 5.5.64-MariaDB-1ubuntu0.14.04.1 – Panki Dec 23 '19 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.