Skip to content

Instantly share code, notes, and snippets.

@mike-marcacci
Created May 19, 2020 00:22
Show Gist options
  • Save mike-marcacci/e0a695cc2424a27b71faa08e9447aa87 to your computer and use it in GitHub Desktop.
Save mike-marcacci/e0a695cc2424a27b71faa08e9447aa87 to your computer and use it in GitHub Desktop.
Querious CA cert bug
printf "\nConnect to mysql...\n\n"
printf "Using this user: root\n"
printf "Using this password: root-password\n"
# Create a temporary mysql instance using docker, letting the OS chose a port.
container=$(docker run -e MYSQL_ROOT_PASSWORD=root-password -d --rm -p 3306 mysql)
# Print the host port used.
printf "Using this port:\n"
docker container port $container
# Print the CA cert.
printf "\nWaiting for cert..."
file=$(pwd)/$container-ca-cert.pem
until docker exec $container cat /var/lib/mysql/ca.pem 2>/dev/null > $file; do
sleep 1
printf "."
done
printf "\n\nUse the cert at: \n $file\n"
# Wait for enter.
printf "\nWhen you're done testing, press enter to clean up."
read > /dev/null
# Cleanup.
docker kill $container
rm $file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment