Running MySQL in a Docker container on MacOS

It’s been a while since I’ve run MySQL server on my MacBook Pro (see past notes here , here and more here) and since I got my new M1 MBP I haven’t installed it yet. Rather than doing a native install, I want to run it as a Docker container so I can throw it away easily when I’m done.

Starting MySQL in a Container

From the MySQL Docker page, run:

docker run -p 3306:3306 --name mysql-springboot -e MYSQL_ROOT_PASSWORD=your-root-pass-here -d mysql

The important part here is -p to expose port 3306 in the container as 3306 on the host. This will allow you to connect to localhost:3306 locally to MySQL in the container as if it’s running locally.

Connecting with mysql shell locally

Connect with mysql shell as if the server is running locally:

mysqlsh -u root

and enter the password when prompted. Create a db and setup a user that you use from your app running locally:

create database example;
create user 'exampleuser' identified by 'examplepassword';
grant all on example.* to 'exampleuser'

2 years later: 2 years of running WordPress and MySQL on Docker in a VPS

It’s been 2 years since I migrated this site from a native install on a VPS to another VPS running Docker. I covered my migration in a number of posts, the first of which is here:

The surprising thing (maybe? maybe not?) is that the site has been up and running for the past 2 years with no issues. I think I rebooted the VPS a couple of times for reasons I can’t remember, but other than that the site’s been up reliably for the past 2 years.

It’s also been 2 years since I last renewed my SSL certificate, so time to do a couple of updates. More to come later.

Weblogic 12c (12.1.3) Datasource for MySQL 8.0.15 getting error: Unable to load authentication plugin ‘caching_sha2_password’

When creating a new Datasource on Weblogic 12.1.3 to MySQL 8.0.15, I got this error:

Unable to load authentication plugin 'caching_sha2_password'.
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)

A quick search found this question, and the solution is to switch the password encryption back to the approach used in prior MySQL versions with:

ALTER USER 'youruserid'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassword';