Practice 02
Practice 02
#- Step 1
cd /opt
tar xf /stage/MySQL-Server/mysql-advanced-5.7*.tar.gz
#- Step 2
ln -s /opt/mysql* /usr/local/mysql
#- Step 3
ls /usr/local/mysql/bin
#- Step 5
source ~/.bashrc
#- Step 6
cp /labs/my.cnf /etc/my.cnf
#- Step 7
cat /etc/my.cnf
#- Step 8
adduser -r mysql
#- Step 9
mysqld --initialize
#- Step 10
mkdir /var/run/mysqld
chown mysql:mysql /var/run/mysqld/
#- Step 11
mysqld_safe &
##====================================##
## Practice 2-2: Connecting to MySQL ##
##====================================##
#- Step 4
ALTER USER USER() IDENTIFIED BY 'oracle';
#- Step 5
EXIT
#- Step 6
mysql -uroot -p
#- Step 8
EXIT
##==============================================##
## Practice 2-3: Configuring the MySQL Service ##
##==============================================##
#- Step 1
mysqladmin -uroot -p shutdown
#- Step 2
cat /labs/service-5.7/mysqld.service
#- Step 3
cp /labs/service-5.7/mysqld.service /usr/lib/systemd/system
#- Step 4
systemctl enable mysqld.service
#- Step 5
systemctl start mysqld
#- Step 6
systemctl status mysqld
##===============================##
## Practice 2-4: Upgrading MySQL ##
##===============================##
#- Step 2
mysqlsh root@localhost -- util checkForServerUpgrade
#- Step 3
systemctl stop mysqld
#- Step 4
systemctl status mysqld
#- Step 5
cd /opt
tar xf /stage/MySQL-Server/mysql-commercial-8*.tar.gz
#- Step 6
ls /opt
#- Step 7
rm /usr/local/mysql
y
#- Step 8
ln -s /opt/mysql-commercial-8* /usr/local/mysql
#- Step 9
cp /labs/service-8.0/mysqld.service /usr/lib/systemd/system
y
#- Step 10
systemctl daemon-reload
#- Step 11
systemctl start mysqld
#- Step 12
systemctl status mysqld
#- Step 13
mysql_upgrade -uroot -p
#- Step 14
systemctl status mysqld -l
#- Step 15
mysqld --version
##============================================##
## Practice 2-5: Deploying MySQL with Docker ##
##============================================##
#- Step 2
docker run --name=mysql1 -d mysql/enterprise-server:8.0
docker ps
#- Step 3
docker logs mysql1 2>&1 | grep GENERATED
#- Step 7
docker stop mysql1
docker ps -a
#- Step 8
docker start mysql1
#- Step 9
docker stop mysql1
#- Step 10
exit