Last active
January 4, 2019 03:51
-
-
Save jamesdavidson/e1ef7d61800349a2e2d98bceed36a582 to your computer and use it in GitHub Desktop.
Notes from automating the installation of MySQL on CentOS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So, what did I try? | |
Well, first I tried to find a CMS that didn't need MySQL. Painful. | |
Then, I tried installing MySQL. They have made this very hard to | |
automate. | |
Then, I tried running MySQL in a Docker container. The first annoying | |
thing here was that I needed a specific version of Docker's API but that | |
also meant a specific version of the Python library and adding | |
api_version=1.19 in the Ansible script too. The second annoying thing | |
was that the Docker module(s) for Ansible basically don't work. The | |
third annoying thing is internal networking... do Docker containers gets | |
hostnames or addresses? | |
Now, I'm back trying to install vanilla MySQL. For years, MySQL has had | |
a blank root password as the default configuration. They recently | |
decided to generate a pseudo-random password instead and stash it in | |
/root/.mysql_secret . Alternatively, one can start up mysqld with | |
--skip-grant-tables and then mess around with permissions then. | |
Alternatively, there's a program called mysql_secure_installation which | |
is wizard that guides you through the process. | |
How am I meant to automate that? Using expect(1) or something? | |
Even when you do extract the temporary password, you can only use it | |
from the command-line, not from the Python library. | |
Exception message: (1862, 'Your password has expired. To log in you must | |
change it using a client that supports expired passwords.') | |
However, if you change your password to be the temporary password then | |
it's all good! | |
sudo mysqladmin --password={{ mysql_root_password }} password {{ | |
mysql_root_password }} | |
Even then, this requires two runs. Why?! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are trying to get a simple localhost MySQL database server up and running then the following setup commands seem to work on CentOS 7.5 as of January 2019:
If you have this Yum config available in /etc/yum.repos.d/mysql57-community.repo :