SlideShare a Scribd company logo
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 !

More Related Content

PDF
Dbdeployer
Giuseppe Maxia
 
PDF
Curso de MySQL 5.7
Eduardo Legatti
 
PPT
Raid designs in Qsan Storage
qsantechnology
 
PDF
Using cobbler in a not so small environment 1.77
chhorn
 
PPTX
Introduction to TrioNAS LX U300
qsantechnology
 
PDF
Installing and Configuring Domino 10 on CentOS 7
Devin Olson
 
PPTX
Hadoop Cluster - Basic OS Setup Insights
Sruthi Kumar Annamnidu
 
Dbdeployer
Giuseppe Maxia
 
Curso de MySQL 5.7
Eduardo Legatti
 
Raid designs in Qsan Storage
qsantechnology
 
Using cobbler in a not so small environment 1.77
chhorn
 
Introduction to TrioNAS LX U300
qsantechnology
 
Installing and Configuring Domino 10 on CentOS 7
Devin Olson
 
Hadoop Cluster - Basic OS Setup Insights
Sruthi Kumar Annamnidu
 

What's hot (20)

PDF
Introduction to Stacki at Atlanta Meetup February 2016
StackIQ
 
PDF
Cobbler, Func and Puppet: Tools for Large Scale Environments
ViSenze - Artificial Intelligence for the Visual Web
 
PDF
Domino9on centos6
a8us
 
PDF
iloug2015.Mysql.for.oracle.dba.V2
Baruch Osoveskiy
 
PDF
Ha cluster with openSUSE Leap
medwinz
 
PDF
Salesforce at Stacki Atlanta Meetup February 2016
StackIQ
 
PPT
WIndows Home Server
Ricky Saltzer
 
PDF
Dockerの準備
koedoyoshida
 
PDF
S4 xen hypervisor_20080622
Todd Deshane
 
PDF
02 install cluster using npaci rocks
Eni Budiyarti
 
PDF
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE
 
PPTX
Ceph Day Bring Ceph To Enterprise
Alex Lau
 
PPTX
Azure VM 101 - HomeGen by CloudGen Verona - Marco Obinu
Marco Obinu
 
PDF
Enterprise manager cloud control 12c(12.1) &agent安装图文指南
maclean liu
 
PDF
Open Source Backup Cpnference 2014: Bareos in scientific environments, by Dr....
NETWAYS
 
PPT
Running hadoop on ubuntu linux
TRCK
 
PPT
Codership's galera cluster installation and quickstart webinar march 2016
Sakari Keskitalo
 
PDF
OSDC 2016 - Tuning Linux for your Database by Colin Charles
NETWAYS
 
PDF
Universal Userland
Sean Chittenden
 
PDF
OSDC 2014: Nat Morris - Open Network Install Environment
NETWAYS
 
Introduction to Stacki at Atlanta Meetup February 2016
StackIQ
 
Cobbler, Func and Puppet: Tools for Large Scale Environments
ViSenze - Artificial Intelligence for the Visual Web
 
Domino9on centos6
a8us
 
iloug2015.Mysql.for.oracle.dba.V2
Baruch Osoveskiy
 
Ha cluster with openSUSE Leap
medwinz
 
Salesforce at Stacki Atlanta Meetup February 2016
StackIQ
 
WIndows Home Server
Ricky Saltzer
 
Dockerの準備
koedoyoshida
 
S4 xen hypervisor_20080622
Todd Deshane
 
02 install cluster using npaci rocks
Eni Budiyarti
 
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE
 
Ceph Day Bring Ceph To Enterprise
Alex Lau
 
Azure VM 101 - HomeGen by CloudGen Verona - Marco Obinu
Marco Obinu
 
Enterprise manager cloud control 12c(12.1) &agent安装图文指南
maclean liu
 
Open Source Backup Cpnference 2014: Bareos in scientific environments, by Dr....
NETWAYS
 
Running hadoop on ubuntu linux
TRCK
 
Codership's galera cluster installation and quickstart webinar march 2016
Sakari Keskitalo
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
NETWAYS
 
Universal Userland
Sean Chittenden
 
OSDC 2014: Nat Morris - Open Network Install Environment
NETWAYS
 
Ad

Similar to Build MySQL virtual enviroment (20)

PDF
Dbdeployer, the universal installer
Giuseppe Maxia
 
PDF
Test complex database systems in your laptop with dbdeployer
Giuseppe Maxia
 
PPTX
Guide to compile your own 4.3.4 cataclysm server
Mohit Maheshwari
 
PDF
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
Atlassian
 
PPTX
tow nodes Oracle 12c RAC on virtualbox
justinit
 
PDF
Netxms install guide
Naga Raju N
 
PPTX
Oracle Sandbox
Datavail
 
PPTX
2017.06.19 Paul Woodward - ExploreVM VMware 101
Paul Woodward Jr
 
PPT
Mysql
Mindtree
 
PDF
MySQL on Docker and Kubernetes
Balasubramanian Kandasamy
 
PDF
JUDCon 2010 Boston : BoxGrinder
marekgoldmann
 
PPTX
3. v sphere big data extensions
Chiou-Nan Chen
 
DOCX
OTRS
Muhammad Qazi
 
PPT
Codership's galera cluster installation and quickstart webinar march 2016
Sakari Keskitalo
 
PPT
Codership's galera cluster installation and quickstart webinar march 2016
Codership Oy - Creators of Galera Cluster
 
PPTX
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Alkin Tezuysal
 
PDF
4 docker small_web_micro_services
FEG
 
PDF
An Express Guide ~ Zabbix for IT Monitoring
Abhishek Kumar
 
PPSX
Linux configer
MD. AL AMIN
 
PDF
Hdf installing-hdf
nmrrsc
 
Dbdeployer, the universal installer
Giuseppe Maxia
 
Test complex database systems in your laptop with dbdeployer
Giuseppe Maxia
 
Guide to compile your own 4.3.4 cataclysm server
Mohit Maheshwari
 
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
Atlassian
 
tow nodes Oracle 12c RAC on virtualbox
justinit
 
Netxms install guide
Naga Raju N
 
Oracle Sandbox
Datavail
 
2017.06.19 Paul Woodward - ExploreVM VMware 101
Paul Woodward Jr
 
Mysql
Mindtree
 
MySQL on Docker and Kubernetes
Balasubramanian Kandasamy
 
JUDCon 2010 Boston : BoxGrinder
marekgoldmann
 
3. v sphere big data extensions
Chiou-Nan Chen
 
Codership's galera cluster installation and quickstart webinar march 2016
Sakari Keskitalo
 
Codership's galera cluster installation and quickstart webinar march 2016
Codership Oy - Creators of Galera Cluster
 
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Alkin Tezuysal
 
4 docker small_web_micro_services
FEG
 
An Express Guide ~ Zabbix for IT Monitoring
Abhishek Kumar
 
Linux configer
MD. AL AMIN
 
Hdf installing-hdf
nmrrsc
 
Ad

Recently uploaded (20)

PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Software Development Methodologies in 2025
KodekX
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
The Future of Artificial Intelligence (AI)
Mukul
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 

Build MySQL virtual enviroment

  • 1. MYSQL 5.7 BUILD YOUR VIRTUAL ENVIRONMENT
  • 2. THE NECESSARY COMPONENTS VirtualBox MySQL 5.7 CENTOS 7.0 www.virtualbox.org dev.mysql.com www.centos.org
  • 5. HOW IT WORKS Start MySQL • VBoxManage startvm MYSQL --type headless Start work-desk • VBoxManage startvm WIN7
  • 6. 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.
  • 7. 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
  • 8. 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”.
  • 10. LET’S FINISH The Oracle VM Virtual Manager will open.
  • 11. <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.
  • 12. SELECT THE FOLDER FOR VIRTUAL DISKS
  • 13. CREATE VIRTUAL MACHINE Click on new button Specify the name and OS
  • 15. VIRTUAL DISK, STEP I Select “Create a virtual hard disk now” and click “Create” Choose "VDI“ (VirtualBox Disk Image) and click "Next"
  • 16. VIRTUAL DISK, STEP II Specify "dynamically allocated" and click “Next” Type the disk name and specify volume size
  • 17. VIRTUAL DISK, STEP III 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 • 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".
  • 20. 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
  • 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 ROOT USER AND PROVIDE PASSWORD, ENTERED DURING CENTOS INSTALLATION PROCEDURE
  • 23. 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
  • 24. 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
  • 25. 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}
  • 26. RESTART THE VIRTUAL MACHINE Execute from command shell • sudo shutdown -r now
  • 27. MYSQL INSTALLATION Remote login • ssh -p 2222 vtvadm@localhost
  • 28. SWITCH INTO ROOT USER Execute from command shell • sudo su -
  • 29. 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
  • 30. 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
  • 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 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
  • 33. 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
  • 34. 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
  • 35. 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
  • 36. 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
  • 37. 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
  • 38. 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.
  • 39. 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
  • 40. 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
  • 41. 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 | +---------------+-----------+-----------------------+
  • 42. 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
  • 43. 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.
  • 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 • Click to launch the MySQL Installer • Choose all products, except MySQL Server
  • 47. CONFIGURE MYSQL CONECTTION CLICK “+” TO OPEN “CONNECTION” DIALOG WINDOW
  • 49. 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
  • 50. IT’S TIME TO COFFEE !