MySQL Server

Hi,

I‘m searching for a MySQL Server snap to use the server as a Storage for a local node-red flow. I tried the beta version of MySQL in devmode but it doesn‘t run as a daemon and it seems very complicated. Does anyone know a way to run a MySQL Server in a Ubuntu core Environment?

Cheers and thanks in advance

Hi,

I’m actually responsible for the MySQL beta snap. As I’m sure you noticed it’s really old, since development was blocked by certain missing features in Snappy. We’d like to get it updated again, so any feedback on usability (what you found complicated, how you would expect to use a MySQL snap, etc.) would be great!

1 Like

Hi,

thanks for your reply. I noticed that it is very old - which features are missing to improve this snap?

If I think about a perfect MySQL snap for my purpose following a few things:

  • No additional steps after snap installation. At the moment you have to change the password and to create a database with the client. A initial configuration or a config file would be great.
  • Included webfrontend (for example phpmyadmin) to CRUD and view databases and tables.
  • Using this Server for example with Node-red would be great
  • Server should run as a service in backround and after Startup (or is it already possible)

Do you think this is possible?

There are some notes about missing features in the blog we had when we first made this (The “going forward” section at https://mysqlrelease.com/2017/01/give-me-a-mysql-and-make-it-snappy/)

The biggest issue was the inability to separate data and binary; removing the mysql-5.7 snap would delete its data, making upgrading difficult.
The second was that it wasn’t possible to start the snap as root (e.g. to run as a system service) and have it drop privileges down to a dedicated user. MySQL should not run as root.

The former has seen som improvements I think, while the latter is still the case (though not as severe since snaps have their own confinement systems).

For your questions, I’ll go through each one:

  • The random expired password is from the default behavior of mysqld --initialize. For regular Debian/Ubuntu packaging we have some alternatives such as instead using unix socket authentication (only host root can log in as mysql root) for the root user, which might be good alternatives for snappy. It should definitely be possible to at least allow these as options, but we need to look into what works best with snaps.

  • We probably won’t include phpmyadmin or other non-Oracle products as part of the snap, but we may be able to make it simple to pair it up with either third-party snaps or possibly an Oracle-provided MySQL Workbench snap to give a more userfriendly frontend.

  • Node-red: I’m not familiar with this software, but as noted above we in general want to make it easier to connect the MySQL snap to others

  • Service in background: As noted above, it’s a fairly strong principle in MySQL that the daemon should not run as root. For regular Ubuntu packages the service will generally be started by root, and then the daemon drops privileges down to the dedicated mysql user. This isn’t currently possible with snaps. It’s not as big a problem as otherwise since snappy has its own confinement system, but it’s still an issue. We may be able to find a workaround, or maybe allow in Edge or similar.

I would recommend to use the socket-based authentication out of the box to provide a usable system that doesn’t require interaction to get running. You can include an install hook script file which runs the initialization of the database on very first installation of the snap. The daemon will then be able to start up directly after being installed and the admin can login using the socket authentication via sudo mysql. This will provide the best first-install experience, and the admin can always change the configuration of the root user in mysql to their desired state once running.

I believe there is work currently being performed to provide snapd capability to support such a scenario. It’s not ready just yet IIRC, but "it is coming"™.