1

I'm trying to find out a way to keep my actual MySQL 5.5 databases on my Ubuntu server (who's used for most of my websites in Apache2) and install another instance of MySQL 8.0 on the same server (for some other websites).

I read online that Docker could be a good idea, so I could install MySQL 8.0 on a docker. The thing is I don't know if this is the best option since I don't know docker actually.

So I'm asking you, do you think running docker is the best plan here? And if not, do you have a better idea?

I am kinda afraid that docker could override my 5.5 version when installing it on docker...

I also found the dbdeployer option, but that seems to be the same kind of thing.

Thanks for your help!

2 Answers 2

5

Running MySQL on docker would be a safe way to achieve what you want to do, it's not going to do anything to your existing MySQL instance.
You can run MySQL 8.0 on a different port in a Docker instance.
Here's how you can do it
When executing docker run, you can pass this on to the command to remap the 3306 port inside the container to 3307 so that your application can connect to MySQL 8.0 instance.
docker run --name=mysql1 -d mysql/mysql-server:tag -p 3307:3306as referenced here
You can also choose to run the MySQL 8.0 from a local data directory and local my.cnf file created by you if you want to optimize the mysql installation, see here.

Note: Do not use the data directory that your current MySQL 5.5 is using (/var/lib/mysql by default) Create a new directory for MySQL 8.0 data directory and new my.cnf file instead.

You can also Try the way Rinzwind suggested, that's a good way to run it as well.

Hope this helps.

2

So I'm asking you, do you think running docker is the best plan here?

No

And if not, do you have a better idea?

Use the generic idea of what is considered the method on doing this: basically you install mysql for every version you need in a different directory and since we are talking 3rd party installs I would opt for /opt/ as that is the intended target for those kind of installs.

For mysql that would be

/opt/mysql-5.5
/opt/mysql-5.5.1
/opt/mysql-5.6
/opt/mysql-8.0

You create all the configuration inside those directories (so the my.cnf inside those directories so you have 1 per install; if you want to run them all at the same time you need a socket and a port per mysql instance).

With a symlink to the binary in the version directories to /opt/mysql you can also switch between the different versions.

The way to do this is more complex though. See for instance the percona site where they use /opt/ for manual install or openark.org where they use /usr/local/ (I like that method too though it does not use /opt).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .