

Usr/local/bin/docker-entrypoint.sh:91: WORDPRESS_DB_PASSWORD Usr/local/bin/docker-entrypoint.sh:90: WORDPRESS_DB_USER Usr/local/bin/docker-entrypoint.sh:89: WORDPRESS_DB_HOST Sr/local/bin/docker-entrypoint.sh:77: # environment variables with a "WORDPRESS_" prefix (ie, "WORDPRESS_AUTH_KEY") # Let's just brute force search everything! Not knowing how the WordPress image is put together I spun up an instance then had a poke around using docker exec -it 123-id-here /bin/bash as usual to get a shell. WORDPRESS_DB_HOSTNAME, WORDPRESS_DB_USER etc. Now the question is, how do you set this with the WordPress docker image? Whenever I’ve used this image before I have set the configuration with environment variables, e.g. Our AWS database is already configured correctly so nothing further to do that side. This isn’t a WordPress specific setting, rather a MySQLi setting to say ‘Use SSL (encryption)’. define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL)

Now according to this trusty StackOverflow answer we can set a flag in our wp-config.php (the main WordPress configuration file) to get the MySQL connection to happen over SSL. If we want to talk between them we best secure the connection otherwise all our data will just be in plaintext for anyone to see. Our WordPress instance and database are just directly on the public internet in different places. In this case however neither of those scenarios match. In my experience WordPress is often in an environment where the MySQL server is either running locally or on another machine that is accessible via some private network.
#Wordpress docker mysql how to
The unknown part was how to do this over SSL using the WordPress docker image. As part of an ongoing experiment with kubernetes and lots of WordPress instances I wanted to set up a site that talked to an Amazon RDS MySQL database.
