MYSQL 5.7
BUILD YOUR VIRTUAL ENVIRONMENT
THE NECESSARY COMPONENTS
VirtualBox MySQL 5.7 CENTOS 7.0
www.virtualbox.org dev.mysql.com www.centos.org
ENVIRONMENT OVERVIEW
MY
LAPTOP
IP =
192.168.122.20
HOW IT LOOKS
HOW IT WORKS
Start MySQL
• VBoxManage startvm MYSQL --type headless
Start work-desk
• VBoxManage startvm WIN7
INSTALLING AND EXPLORING VIRTUALBOX
VirtualBox.org
• The VirtualBox installer is available from virtualbox.org
• We could either click this big, green button or navigate over to the downloads link on the left side of the page.
• Here under VirtualBox platform packages, there are the links to download installer for VirtualBox for various
platforms.
DOWNLOAD
Windows users
• Click on <Windows hosts> labels
• Select a place to save the file
“VirtualBox-6.0.4-128413-Win.exe”
Linux users
• Click on <Linux distributions> to check available options:
• Ubuntu 18.04 / 18.10 / Debian 10
• OpenSUSE 15.0
• Fedora 29
• Oracle Linux 7 / Red Hat 7 / CENTOS 7
Save the “VirtualBox-6.0-6.0.4_128413_el7-1.x86_64.rpm” file
INSTALLATION
Windows users
• After you download binary, it is time to install VirtualBox.
• You will need to have administrator privileges in order to install the software.
Linux users
• Execute from command shell in terminal.• Double click on file
“VirtualBox-6.0.4-128413-Win.exe” and click
on “Run”.
LET’S START
LET’S FINISH
The Oracle VM Virtual Manager will open.
<OBTAIN A CENTOS IMAGE>
TO INSTALL CENTOS IN VIRTUALBOX, FIRST WE
NEED AN INSTALLATION IMAGE OR DISC.
WHILE VIRTUALBOX ALLOWS YOU TO CONNECT TO
A SYSTEM'S OPTICAL DRIVE, TO INSTALL FROM A CD
OR DVD, THE PROCESS WE'LL GO THROUGH IN THIS
VIDEO USES AN ISO IMAGE.
IT IS A FILE THAT REPRESENTS THE CONTENTS OF AN
INSTALLATION DISC.
SELECT THE FOLDER FOR VIRTUAL DISKS
CREATE VIRTUAL MACHINE
Click on new button Specify the name and OS
SET UP HARDWARE
Memory Display
VIRTUAL DISK, STEP I
Select “Create a virtual hard
disk now” and click “Create”
Choose "VDI“ (VirtualBox Disk
Image) and click "Next"
VIRTUAL DISK, STEP II
Specify "dynamically allocated"
and click “Next”
Type the disk name and specify
volume size
VIRTUAL DISK, STEP III
ATTACH A CENTOS ISO IMAGE TO VIRTUAL DVD DEVICE
CENTOS VM
WAS CREATED
• Name: MYSQL
• OS: CentOS 7.0 64-bit
• RAM: 640 MB
• HDD: 16GB
• Video: 128 MB
• Network: VIRTUAL NAT
BUILD YOUR
VIRTUAL
NETWORK
• Click on File->Preferences,
select "Network“, and click on
"+ (Adds New NAT Network)“
on "NAT Networks" tab.
• Click on "Edits Selected NAT Network",
make sure "Supports DHCP" is
enabled, and click "OK".
LOCAL PORT FORWARDING
To allow an access to VM from your laptop, you need to set up the
port forwarding
• Click <Port forwarding> button inside “NAT
Network details” dialog window
• Click <Add new rule> button
• Specify:
Rule name - ssh-MYSQL
Protocol - TCP
Host IP – leave it blank
Host port – 2222
Guest IP - 192.168.122.5
Guest port - 22
FIRST CENTOS RUN
• Click on Machine->Start,
select "Normal start“
or
• Click on “Start” button
Execute from command prompt in
terminal
• VBoxManage startvm MYSQL
LOGIN
LOGIN AS ROOT USER AND PROVIDE PASSWORD, ENTERED DURING CENTOS INSTALLATION PROCEDURE
CHANGE HOST NAME
Set the new name
• echo vm-mysql > /etc/hostname
Assign IP to new local name
• echo “127.0.0.1 vm-mysql” >> /etc/hosts
CREATE USER FOR REMOTE LOGIN
Add necessary groups
• groupadd --gid 444 vtvadm
Create user
• useradd -m -d /home/vtvadm -s /bin/bash -c "VM Administrator" 
-u 444 -g vtvadm -G wheel,vboxsf vtvadm
CREATE MYSQL USER
Add necessary groups
• grpName=mysql
usrName=mysql
grpID=7887
usrID=333
• groupadd --gid ${grpID} ${grpName}
Creating the MySQL owner user
• useradd -r -u ${usrID} -g ${grpName} -s /bin/false 
-c "MySQL/MariaDB owner" ${usrName}
RESTART THE VIRTUAL MACHINE
Execute from command shell
• sudo shutdown -r now
MYSQL INSTALLATION
Remote login
• ssh -p 2222 vtvadm@localhost
SWITCH INTO ROOT USER
Execute from command shell
• sudo su -
DOWNLOAD MYSQL BINARIES
Switch into MySQL home directory
• cd /usr/local
Download binaries
• wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.25-el7-
x86_64.tar
BUILD MYSQL CONFIG FILE
Backup old config file
• mv /etc/my.cnf /etc/my.cnf.old
Create new one and copy/paste lines from right text box
• vi /etc/my.cnf
[client]
socket=/var/tmp/mysql.sock
port=3306
[mysqld]
user=mysql
port=3306
bind-address=192.168.122.5
basedir=/usr/local/mysql
datadir=/usr/local/mysql/mysql-files
socket=/var/tmp/mysql.sock
log-error=/usr/local/mysql/other/logs/mysql.log
pid-file=/usr/local/mysql/other/pid/mysql.pid
[mysqld_safe]
user=mysql
port=3306
basedir=/usr/local/mysql
datadir=/usr/local/mysql/mysql-files
socket=/var/tmp/mysql.sock
log-error=/usr/local/mysql/other/logs/mysql.log
pid-file=/usr/local/mysql/other/pid/mysql.pid
PREINSTALLATION TASKS
Check dependency
• MySQL has a dependency on the libaio library.
• For Non-Uniform Memory Access (NUMA) MySQL requires he libnuma library.
[root@vm-mysql local]# yum list installed | egrep -i "libaio|libnuma"
libaio.x86_64 0.3.109-13.el7 @anaconda
[root@vm-mysql local]#
UNPACK THE DISTRIBUTION
Pick the necessary directory
• cd /usr/local
[tar -tf mysql-5.7.25-el7-x86_64.tar
-rw-r--r-- pb2user/common 713660830 2018-12-21 12:26 mysql-5.7.25-el7-x86_64.tar.gz
-rw-r--r-- pb2user/common 30221541 2018-12-21 12:24 mysql-test-5.7.25-el7-x86_64.tar.gz
Unpack the distribution
• tar zxvf mysql-5.7.25-el7-x86_64.tar
Check obtained files
Unpack the MySQL binaries
• tar zxvf mysql-5.7.25-el7-x86_64.tar.gz
CREATE THY MYSQL DIRECTORY TREE, STEP I
ls -lh /usr/local
total 710M
drwxr-xr-x. 2 root root 4.0K Mar 12 12:20 bin
drwxr-xr-x. 2 root root 4.0K Apr 11 2018 etc
drwxr-xr-x. 2 root root 4.0K Apr 11 2018 games
drwxr-xr-x. 2 root root 4.0K Apr 11 2018 include
drwxr-xr-x. 2 root root 4.0K Mar 12 12:20 lib
drwxr-xr-x. 2 root root 4.0K Apr 11 2018 lib64
drwxr-xr-x. 2 root root 4.0K Apr 11 2018 libexec
drwxr-xr-x. 11 root root 4.0K Mar 25 18:35 mysql-5.7.25-el7-x86_64
-rw-r--r--. 1 root root 710M Dec 21 11:27 mysql-5.7.25-el7-x86_64.tar
drwxr-xr-x. 2 root root 4.0K Apr 11 2018 sbin
drwxr-xr-x. 5 root root 4.0K Apr 11 2018 share
drwxr-xr-x. 2 root root 4.0K Apr 11 2018 src
Check extracted directories
Create a symbolic link to the installation directory created by tar
• ln -s /usr/local/mysql-5.7.25-el7-x86_64 mysql
CREATE THY MYSQL DIRECTORY TREE, STEP II
ls -lh
total 60K
drwxr-xr-x. 2 root root 4.0K Mar 25 17:40 bin
-rw-r--r--. 1 7161 31415 18K Dec 21 11:39 COPYING
drwxr-xr-x. 2 root root 4.0K Mar 25 17:40 docs
drwxr-xr-x. 3 root root 4.0K Mar 25 17:40 include
drwxr-xr-x. 5 root root 4.0K Mar 25 17:40 lib
drwxr-xr-x. 4 root root 4.0K Mar 25 17:40 man
drwxr-x---. 5 mysql mysql 4.0K Apr 4 15:15 mysql-files
drwxr-x---. 5 mysql mysql 4.0K Mar 25 18:35 other
-rw-r--r--. 1 7161 31415 2.5K Dec 21 11:39 README
drwxr-xr-x. 28 root root 4.0K Mar 25 17:40 share
drwxr-xr-x. 2 root root 4.0K Mar 25 17:40 support-files
Check MySQL base directory
Come into MySQL base directory
• cd /usr/local/mysql
CREATE THY MYSQL DIRECTORY TREE, STEP III
Assign directories permission to mysql user
• chown -R mysql:mysql mysql-files
• chown mysql:mysql other
• chmod -R 750 mysql-files
• chmod -R 750 other
Create the necessary subdirectories
• mkdir -p /usr/local/mysql/mysql-files
• mkdir -p /usr/local/mysql/other/logs
• mkdir -p /usr/local/mysql/other/pid
• mkdir -p /usr/local/mysql/other/socket
MODIFY MYSQL STARTUP SCRIPT
Copy modified script to make it executable on startup
• cp /usr/local/mysql/support-files/mysql.server
/etc/init.d/mysql.server
Edit the script and modify it, using the lines below
• vi /usr/local/mysql/support-files/mysql.server
# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.
basedir=/usr/local/mysql
datadir=/usr/local/mysql/mysql-files
FIRST MYSQL LAUNCH
Configure secure access
• /usr/local/mysql/bin/mysql_ssl_rsa_setup
Create and initialise the system databases
• /usr/local/mysql/bin/mysqld --initialize --user=mysql
MySQL instance startup
• /usr/local/mysql/bin/mysqld_safe --user=mysql &
Start MySQL service
• service mysql stop
• service mysql start
CHECK MYSQL INSTANCE STATUS
Execute from command shell
• sudo service mysql status
Redirecting to /bin/systemctl status mysql.service
● mysql.server.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysql.server; bad; vendor preset: disabled)
Active: active (running) since Thu 2019-04-04 17:46:07 CEST; 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 2144 ExecStop=/etc/rc.d/init.d/mysql.server stop (code=exited, status=0/SUCCESS)
Process: 2186 ExecStart=/etc/rc.d/init.d/mysql.server start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysql.server.service
├─2199 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/mysql-files --pid-
file=/usr/local/mysql/other/pid/mysql.p...
└─2477 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/mysql-files --plugin-
dir=/usr/local/mysql/l...
Apr 04 17:46:06 vm-mysql systemd[1]: Starting LSB: start and stop MySQL...
Apr 04 17:46:07 vm-mysql mysql.server[2186]: Starting MySQL. SUCCESS!
Apr 04 17:46:07 vm-mysql systemd[1]: Started LSB: start and stop MySQL.
RESET MYSQL TEMPORARY ROOT PASSWORD
Set new root password
• mysqladmin -u root -p'OldPassword' password 'NewPassword'
Find location of MySQL log file
• logMY=$(grep log /etc/my.cnf | head -1 | awk -F"=" '{print $2}’)
• echo $logMY
Find temporary MySQL root password
• grep -i "temporary password" $logMY
CREATE THE REMOTE ADMINISTRATIVE ACCOUNT
CREATE USER
'master'@'%'
IDENTIFIED WITH mysql_native_password BY 'SetYourPassword'
PASSWORD EXPIRE NEVER ACCOUNT UNLOCK
;
GRANT ALL
ON *.*
TO 'master'@'%'
WITH GRANT OPTION;
Execute the statement below
Connect to MySQL instance as root user
• mysql -u root -p
CHECK CONNECTION TO THE DATABASE
Execute from command shell
• mysql -u master -p -e "SELECT User, Host, plugin FROM mysql.user" mysql
+---------------+-----------+-----------------------+
| User | Host | plugin |
+---------------+-----------+-----------------------+
| root | localhost | mysql_native_password |
| mysql.session | localhost | mysql_native_password |
| mysql.sys | localhost | mysql_native_password |
| master | % | mysql_native_password |
+---------------+-----------+-----------------------+
CONFIGURE MYSQL AUTOSTARTUP
mysql.server 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Check the status
• chkconfig --list mysql.server
Add MySQL to the auto startup service
• chkconfig --add mysql.server
• chkconfig --level 345 mysql.server on
VIRTUAL WINDOWS WORKPLACE
To launch a Windows VM, execute from command prompt on laptop
[tvasyliuk@oc0062545132 ~]$ VBoxManage startvm WIN7
Waiting for VM "WIN7" to power on...
VM "WIN7" has been successfully started.
MYSQL CLIENT INSTALLER
• MySQL Installer is a wizard-based installation experience for
all your MySQL software.
• MySQL Installer is 32 bit, but will install both 32 bit and 64
bit binaries.
• Click here download and save the MySQL Installer
INSTALLATION PROCESS
• Click to launch the MySQL Installer • Choose all products, except MySQL Server
CONFIGURE
MYSQL
WORKBENCH
• Launch the MySQL WorkBench
CONFIGURE
MYSQL
CONECTTION
CLICK “+” TO OPEN
“CONNECTION” DIALOG
WINDOW
MANAGE
MYSQL
CONNECTION
CONNECT TO MYSQL
•Click on “dba@mysql” button to
connect
•TYPE the “SELECT * FROM USER”
QUERY AND press run button
•The result will appear in data grid
IT’S TIME TO COFFEE !

Build MySQL virtual enviroment

  • 1.
    MYSQL 5.7 BUILD YOURVIRTUAL ENVIRONMENT
  • 2.
    THE NECESSARY COMPONENTS VirtualBoxMySQL 5.7 CENTOS 7.0 www.virtualbox.org dev.mysql.com www.centos.org
  • 3.
  • 4.
  • 5.
    HOW IT WORKS StartMySQL • VBoxManage startvm MYSQL --type headless Start work-desk • VBoxManage startvm WIN7
  • 6.
    INSTALLING AND EXPLORINGVIRTUALBOX VirtualBox.org • The VirtualBox installer is available from virtualbox.org • We could either click this big, green button or navigate over to the downloads link on the left side of the page. • Here under VirtualBox platform packages, there are the links to download installer for VirtualBox for various platforms.
  • 7.
    DOWNLOAD Windows users • Clickon <Windows hosts> labels • Select a place to save the file “VirtualBox-6.0.4-128413-Win.exe” Linux users • Click on <Linux distributions> to check available options: • Ubuntu 18.04 / 18.10 / Debian 10 • OpenSUSE 15.0 • Fedora 29 • Oracle Linux 7 / Red Hat 7 / CENTOS 7 Save the “VirtualBox-6.0-6.0.4_128413_el7-1.x86_64.rpm” file
  • 8.
    INSTALLATION Windows users • Afteryou download binary, it is time to install VirtualBox. • You will need to have administrator privileges in order to install the software. Linux users • Execute from command shell in terminal.• Double click on file “VirtualBox-6.0.4-128413-Win.exe” and click on “Run”.
  • 9.
  • 10.
    LET’S FINISH The OracleVM Virtual Manager will open.
  • 11.
    <OBTAIN A CENTOSIMAGE> TO INSTALL CENTOS IN VIRTUALBOX, FIRST WE NEED AN INSTALLATION IMAGE OR DISC. WHILE VIRTUALBOX ALLOWS YOU TO CONNECT TO A SYSTEM'S OPTICAL DRIVE, TO INSTALL FROM A CD OR DVD, THE PROCESS WE'LL GO THROUGH IN THIS VIDEO USES AN ISO IMAGE. IT IS A FILE THAT REPRESENTS THE CONTENTS OF AN INSTALLATION DISC.
  • 12.
    SELECT THE FOLDERFOR VIRTUAL DISKS
  • 13.
    CREATE VIRTUAL MACHINE Clickon new button Specify the name and OS
  • 14.
  • 15.
    VIRTUAL DISK, STEPI Select “Create a virtual hard disk now” and click “Create” Choose "VDI“ (VirtualBox Disk Image) and click "Next"
  • 16.
    VIRTUAL DISK, STEPII Specify "dynamically allocated" and click “Next” Type the disk name and specify volume size
  • 17.
    VIRTUAL DISK, STEPIII ATTACH A CENTOS ISO IMAGE TO VIRTUAL DVD DEVICE
  • 18.
    CENTOS VM WAS CREATED •Name: MYSQL • OS: CentOS 7.0 64-bit • RAM: 640 MB • HDD: 16GB • Video: 128 MB • Network: VIRTUAL NAT
  • 19.
    BUILD YOUR VIRTUAL NETWORK • Clickon File->Preferences, select "Network“, and click on "+ (Adds New NAT Network)“ on "NAT Networks" tab. • Click on "Edits Selected NAT Network", make sure "Supports DHCP" is enabled, and click "OK".
  • 20.
    LOCAL PORT FORWARDING Toallow an access to VM from your laptop, you need to set up the port forwarding • Click <Port forwarding> button inside “NAT Network details” dialog window • Click <Add new rule> button • Specify: Rule name - ssh-MYSQL Protocol - TCP Host IP – leave it blank Host port – 2222 Guest IP - 192.168.122.5 Guest port - 22
  • 21.
    FIRST CENTOS RUN •Click on Machine->Start, select "Normal start“ or • Click on “Start” button Execute from command prompt in terminal • VBoxManage startvm MYSQL
  • 22.
    LOGIN LOGIN AS ROOTUSER AND PROVIDE PASSWORD, ENTERED DURING CENTOS INSTALLATION PROCEDURE
  • 23.
    CHANGE HOST NAME Setthe new name • echo vm-mysql > /etc/hostname Assign IP to new local name • echo “127.0.0.1 vm-mysql” >> /etc/hosts
  • 24.
    CREATE USER FORREMOTE LOGIN Add necessary groups • groupadd --gid 444 vtvadm Create user • useradd -m -d /home/vtvadm -s /bin/bash -c "VM Administrator" -u 444 -g vtvadm -G wheel,vboxsf vtvadm
  • 25.
    CREATE MYSQL USER Addnecessary groups • grpName=mysql usrName=mysql grpID=7887 usrID=333 • groupadd --gid ${grpID} ${grpName} Creating the MySQL owner user • useradd -r -u ${usrID} -g ${grpName} -s /bin/false -c "MySQL/MariaDB owner" ${usrName}
  • 26.
    RESTART THE VIRTUALMACHINE Execute from command shell • sudo shutdown -r now
  • 27.
    MYSQL INSTALLATION Remote login •ssh -p 2222 vtvadm@localhost
  • 28.
    SWITCH INTO ROOTUSER Execute from command shell • sudo su -
  • 29.
    DOWNLOAD MYSQL BINARIES Switchinto MySQL home directory • cd /usr/local Download binaries • wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.25-el7- x86_64.tar
  • 30.
    BUILD MYSQL CONFIGFILE Backup old config file • mv /etc/my.cnf /etc/my.cnf.old Create new one and copy/paste lines from right text box • vi /etc/my.cnf [client] socket=/var/tmp/mysql.sock port=3306 [mysqld] user=mysql port=3306 bind-address=192.168.122.5 basedir=/usr/local/mysql datadir=/usr/local/mysql/mysql-files socket=/var/tmp/mysql.sock log-error=/usr/local/mysql/other/logs/mysql.log pid-file=/usr/local/mysql/other/pid/mysql.pid [mysqld_safe] user=mysql port=3306 basedir=/usr/local/mysql datadir=/usr/local/mysql/mysql-files socket=/var/tmp/mysql.sock log-error=/usr/local/mysql/other/logs/mysql.log pid-file=/usr/local/mysql/other/pid/mysql.pid
  • 31.
    PREINSTALLATION TASKS Check dependency •MySQL has a dependency on the libaio library. • For Non-Uniform Memory Access (NUMA) MySQL requires he libnuma library. [root@vm-mysql local]# yum list installed | egrep -i "libaio|libnuma" libaio.x86_64 0.3.109-13.el7 @anaconda [root@vm-mysql local]#
  • 32.
    UNPACK THE DISTRIBUTION Pickthe necessary directory • cd /usr/local [tar -tf mysql-5.7.25-el7-x86_64.tar -rw-r--r-- pb2user/common 713660830 2018-12-21 12:26 mysql-5.7.25-el7-x86_64.tar.gz -rw-r--r-- pb2user/common 30221541 2018-12-21 12:24 mysql-test-5.7.25-el7-x86_64.tar.gz Unpack the distribution • tar zxvf mysql-5.7.25-el7-x86_64.tar Check obtained files Unpack the MySQL binaries • tar zxvf mysql-5.7.25-el7-x86_64.tar.gz
  • 33.
    CREATE THY MYSQLDIRECTORY TREE, STEP I ls -lh /usr/local total 710M drwxr-xr-x. 2 root root 4.0K Mar 12 12:20 bin drwxr-xr-x. 2 root root 4.0K Apr 11 2018 etc drwxr-xr-x. 2 root root 4.0K Apr 11 2018 games drwxr-xr-x. 2 root root 4.0K Apr 11 2018 include drwxr-xr-x. 2 root root 4.0K Mar 12 12:20 lib drwxr-xr-x. 2 root root 4.0K Apr 11 2018 lib64 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 libexec drwxr-xr-x. 11 root root 4.0K Mar 25 18:35 mysql-5.7.25-el7-x86_64 -rw-r--r--. 1 root root 710M Dec 21 11:27 mysql-5.7.25-el7-x86_64.tar drwxr-xr-x. 2 root root 4.0K Apr 11 2018 sbin drwxr-xr-x. 5 root root 4.0K Apr 11 2018 share drwxr-xr-x. 2 root root 4.0K Apr 11 2018 src Check extracted directories Create a symbolic link to the installation directory created by tar • ln -s /usr/local/mysql-5.7.25-el7-x86_64 mysql
  • 34.
    CREATE THY MYSQLDIRECTORY TREE, STEP II ls -lh total 60K drwxr-xr-x. 2 root root 4.0K Mar 25 17:40 bin -rw-r--r--. 1 7161 31415 18K Dec 21 11:39 COPYING drwxr-xr-x. 2 root root 4.0K Mar 25 17:40 docs drwxr-xr-x. 3 root root 4.0K Mar 25 17:40 include drwxr-xr-x. 5 root root 4.0K Mar 25 17:40 lib drwxr-xr-x. 4 root root 4.0K Mar 25 17:40 man drwxr-x---. 5 mysql mysql 4.0K Apr 4 15:15 mysql-files drwxr-x---. 5 mysql mysql 4.0K Mar 25 18:35 other -rw-r--r--. 1 7161 31415 2.5K Dec 21 11:39 README drwxr-xr-x. 28 root root 4.0K Mar 25 17:40 share drwxr-xr-x. 2 root root 4.0K Mar 25 17:40 support-files Check MySQL base directory Come into MySQL base directory • cd /usr/local/mysql
  • 35.
    CREATE THY MYSQLDIRECTORY TREE, STEP III Assign directories permission to mysql user • chown -R mysql:mysql mysql-files • chown mysql:mysql other • chmod -R 750 mysql-files • chmod -R 750 other Create the necessary subdirectories • mkdir -p /usr/local/mysql/mysql-files • mkdir -p /usr/local/mysql/other/logs • mkdir -p /usr/local/mysql/other/pid • mkdir -p /usr/local/mysql/other/socket
  • 36.
    MODIFY MYSQL STARTUPSCRIPT Copy modified script to make it executable on startup • cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server Edit the script and modify it, using the lines below • vi /usr/local/mysql/support-files/mysql.server # If you change base dir, you must also change datadir. These may get # overwritten by settings in the MySQL configuration files. basedir=/usr/local/mysql datadir=/usr/local/mysql/mysql-files
  • 37.
    FIRST MYSQL LAUNCH Configuresecure access • /usr/local/mysql/bin/mysql_ssl_rsa_setup Create and initialise the system databases • /usr/local/mysql/bin/mysqld --initialize --user=mysql MySQL instance startup • /usr/local/mysql/bin/mysqld_safe --user=mysql & Start MySQL service • service mysql stop • service mysql start
  • 38.
    CHECK MYSQL INSTANCESTATUS Execute from command shell • sudo service mysql status Redirecting to /bin/systemctl status mysql.service ● mysql.server.service - LSB: start and stop MySQL Loaded: loaded (/etc/rc.d/init.d/mysql.server; bad; vendor preset: disabled) Active: active (running) since Thu 2019-04-04 17:46:07 CEST; 9s ago Docs: man:systemd-sysv-generator(8) Process: 2144 ExecStop=/etc/rc.d/init.d/mysql.server stop (code=exited, status=0/SUCCESS) Process: 2186 ExecStart=/etc/rc.d/init.d/mysql.server start (code=exited, status=0/SUCCESS) CGroup: /system.slice/mysql.server.service ├─2199 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/mysql-files --pid- file=/usr/local/mysql/other/pid/mysql.p... └─2477 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/mysql-files --plugin- dir=/usr/local/mysql/l... Apr 04 17:46:06 vm-mysql systemd[1]: Starting LSB: start and stop MySQL... Apr 04 17:46:07 vm-mysql mysql.server[2186]: Starting MySQL. SUCCESS! Apr 04 17:46:07 vm-mysql systemd[1]: Started LSB: start and stop MySQL.
  • 39.
    RESET MYSQL TEMPORARYROOT PASSWORD Set new root password • mysqladmin -u root -p'OldPassword' password 'NewPassword' Find location of MySQL log file • logMY=$(grep log /etc/my.cnf | head -1 | awk -F"=" '{print $2}’) • echo $logMY Find temporary MySQL root password • grep -i "temporary password" $logMY
  • 40.
    CREATE THE REMOTEADMINISTRATIVE ACCOUNT CREATE USER 'master'@'%' IDENTIFIED WITH mysql_native_password BY 'SetYourPassword' PASSWORD EXPIRE NEVER ACCOUNT UNLOCK ; GRANT ALL ON *.* TO 'master'@'%' WITH GRANT OPTION; Execute the statement below Connect to MySQL instance as root user • mysql -u root -p
  • 41.
    CHECK CONNECTION TOTHE DATABASE Execute from command shell • mysql -u master -p -e "SELECT User, Host, plugin FROM mysql.user" mysql +---------------+-----------+-----------------------+ | User | Host | plugin | +---------------+-----------+-----------------------+ | root | localhost | mysql_native_password | | mysql.session | localhost | mysql_native_password | | mysql.sys | localhost | mysql_native_password | | master | % | mysql_native_password | +---------------+-----------+-----------------------+
  • 42.
    CONFIGURE MYSQL AUTOSTARTUP mysql.server0:off 1:off 2:on 3:on 4:on 5:on 6:off Check the status • chkconfig --list mysql.server Add MySQL to the auto startup service • chkconfig --add mysql.server • chkconfig --level 345 mysql.server on
  • 43.
    VIRTUAL WINDOWS WORKPLACE Tolaunch a Windows VM, execute from command prompt on laptop [tvasyliuk@oc0062545132 ~]$ VBoxManage startvm WIN7 Waiting for VM "WIN7" to power on... VM "WIN7" has been successfully started.
  • 44.
    MYSQL CLIENT INSTALLER •MySQL Installer is a wizard-based installation experience for all your MySQL software. • MySQL Installer is 32 bit, but will install both 32 bit and 64 bit binaries. • Click here download and save the MySQL Installer
  • 45.
    INSTALLATION PROCESS • Clickto launch the MySQL Installer • Choose all products, except MySQL Server
  • 46.
  • 47.
    CONFIGURE MYSQL CONECTTION CLICK “+” TOOPEN “CONNECTION” DIALOG WINDOW
  • 48.
  • 49.
    CONNECT TO MYSQL •Clickon “dba@mysql” button to connect •TYPE the “SELECT * FROM USER” QUERY AND press run button •The result will appear in data grid
  • 50.