MySQL Source Installs for each RDS version

I have been doing a lot of Oracle and PeopleSoft work this year, but I am trying to continue to develop my MySQL and Amazon Web Services (AWS) knowledge at the same time. My goal is to learn some new thing about MySQL and AWS each month and then document it either on this blog or on my company’s internal web site.

This month I decided to focus on building a Linux virtual machine on VirtualBox that has the source code for each version of MySQL that we support on AWS through RDS. I already had an Oracle Linux VM with MySQL 5.7.20 installed from source code from the MySQL GitHub site. So, all I had to do was get the source code to the correct release in git and then recompile it and create a test database. Then I could save a VirtualBox snapshot for that release.

I don’t want to spend time here describing how I did the initial MySQL 5.7.20 install except to say that I followed the steps in the 5.7 reference manual section titled “2.9 Installing MySQL from Source“. The GitHub specific instructions were in the section titled “2.9.3 Installing MySQL Using a Development Source Tree“. I can’t remember why it was a problem, but I could not get Boost installed correctly for CMake to pick it up, so I pass the path to Boost to CMake using the following command:

cmake . -DWITH_BOOST=/home/bobby/boost_1_59_0

instead of what is in the manual. Otherwise I just followed the manual.

I looked at our AWS MySQL RDS databases and found 4 versions: 5.5.46, 5.6.34, 5.7.17, and 5.7.25. So, I wanted to install each of these from source. My idea is that if we hit a bug or unexpected behavior, I can try different versions and see if that behavior is version specific. We could also dive into the source if needed and have the correct version.

Here are the steps that I put together that worked for our 5.7 databases:

cd /home/bobby/mysql-server

make clean

rm CMakeCache.txt

git checkout 5.7

git pull

git checkout mysql-5.7.17

cmake . -DWITH_BOOST=/home/bobby/boost_1_59_0

make

su - root

cd /home/bobby/mysql-server

make install

cd /usr/local/mysql/data

rm -rf *

cd ..

bin/mysqld --initialize --user=mysql

bin/mysql_ssl_rsa_setup

mysqld_safe --user=mysql &

mysql -p

use default password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'My!Password1234';

mysql -p

use My!Password1234

My git repository was /home/bobby/mysql-server and my Linux username was bobby. The database is in /usr/local/mysql/data. The 5.6 and 5.5 databases had a different way to create the database and change the password:

Replace these lines:

bin/mysqld --initialize --user=mysql

bin/mysql_ssl_rsa_setup

mysqld_safe --user=mysql &

mysql -p

use default password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'My!Password1234';

with

scripts/mysql_install_db --user=mysql

./bin/mysqld_safe &

./bin/mysqladmin -u root password 'My!Password1234'

./bin/mysqladmin -u root -h mysqlsrc password 'My!Password1234'

Here are some pictures from the 5.7.17 final working install:

Clean up from previous install
Switch to 5.7 branch
Go to 5.7.17 release
End of cmake step to setup options for make
End of make
End of make install
Database initialized after old database deleted
Setup keys
Up on correct version 5.7.17
All four versions on their own snapshots

Time will tell if this setup really helps us during some sort of problem, but I like having the source code in case we hit a bug or unexpected behavior. The great thing about open source is that we can see the code, so why not use it?

Bobby

Update: 2/4/2021

I have not used this setup since I published this post in May 2019. But today I finished adding MySQL 8.0.20 to my VirtualBox snapshots because we now have a AWS RDS instance of that version. Maybe some day I will need to look at the source code for a particular version, who knows. Here are some of the commands I had to run to get 8.0.20 to work after starting with my 5.7.17 snapshot.

Followed this page to get a new enough version of gcc installed:

https://community.oracle.com/tech/apps-infra/discussion/4333499/how-to-get-gcc-version-8-installed

yum -y install oracle-softwarecollection-release-el7
/usr/bin/ol_yum_configure.sh

added

sslverify=0

to /etc/yum.conf

yum-config-manager --enable ol7_optional_latest

yum install devtoolset-9

scl enable devtoolset-9 -- gcc --version

source /opt/rh/devtoolset-9/enable 

eventually added that line to .bash_profile for root and bobby users

I ended up having to blow away the source tree and reload it due to issues.

rm -rf mysql-server
git clone https://github.com/mysql/mysql-server.git
cd mysql-server

git checkout mysql-8.0.20

mkdir bld
cd bld
cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/home/bobby/newerboost

This got the cmake to run without errors. After this the steps were the same as for 5.7.

About Bobby

I live in Chandler, Arizona with my wife and three daughters. I work for US Foods, the second largest food distribution company in the United States. I have worked in the Information Technology field since 1989. I have a passion for Oracle database performance tuning because I enjoy challenging technical problems that require an understanding of computer science. I enjoy communicating with people about my work.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.