0

I'm trying to write a backup program that works everywhere and is easy to install. My program downloads a mysqldump binary and runs it to export the database.

I want to avoid requiring users of my program to download and install mysql/mysqldump.

If I download a mysqldump binary, can I expect it to work on all Linux distributions?

Matthieu Napoli
  • 421
  • 1
  • 5
  • 11
  • As far as I remember, `mysqldump` is part of `mysql-client`. So as long as the binary is compatible with the OS, it should be fine. – Prav Jun 03 '18 at 15:57
  • Also, rather than including a fixed version of the binary, why don't you install the compatible version if it doesn't exist? – Prav Jun 03 '18 at 15:58
  • I don't want the user to install MySQL or any package. I want to download the binary from my server and run it. What I'm worried about is that the `mysqldump` binary is not portable across OSes. – Matthieu Napoli Jun 03 '18 at 16:14
  • I've only tried on Ubuntu and CentOS and they worked just fine. What kind of program are you writing? Script or binary? – Prav Jun 03 '18 at 16:20
  • A Go program, so it will be a binary. – Matthieu Napoli Jun 03 '18 at 16:42
  • My suggestion would be to use `exec` command to run `apt-get -y install mysql-client` or `yum` for Debian and CentOs to install the OS compatible version. Other than that, MySQL doesn't give much information about the compatibility of different architecture (32-bit/64-bit) and OS flavours. The only way to say is to test out the program on all Linux distros. – Prav Jun 03 '18 at 16:50
  • Its might be worth asking on [Database Administrators](https://dba.stackexchange.com/) as well – Prav Jun 03 '18 at 16:56
  • At one point Mysql released a statically built binaries. Not sure if that still exists though. – Zoredache Jun 04 '18 at 00:59
  • @Zoredache just to be sure I understand: by "statically built binary" you mean a binary that contains all its dependencies and can run regardless of what's installed on the system (as opposed to a binary with dynamic dependencies) is that right? So if the program is dynamically built it won't work, but if it's statically built it will work? – Matthieu Napoli Jun 04 '18 at 21:03
  • Well, more or less. It probably doesn't have all the dependencies. But a program/library that has been [statically built](https://en.wikipedia.org/wiki/Static_library) will usually require much less in the way of dependencies. It all depends on specifically how the binaries were built. For some things, it isn't possible to be 100% dependency free. But you probably don't need that, you just need something that will work on all the commonly deployed linux systems, which may be possible via some of the official mysql downloads. – Zoredache Jun 04 '18 at 21:16

0 Answers0