What is MySQL:
MySQL is Database Service, and its fully managed database service to deploy cloud-native applications.
We are using Cento7 instance and Db01 for Database.
Follow the step to install database server(MYSQL) to virtual box.
Login to Database server
Vagrant ssh db01
To check Hosts entry, if something is missing update we can try using IP and its hostname
cat /etc/hosts
Convert vagrant user to root user
Sudo -i (or) Sudo su
OS Update
yum update -y
To set Repository
Yum install epel-release -y
More info about this command:
epel-Extra Packages for Enterprise Linux(epel)
For MySQL we use Centos7 server its a free base so we may need additional repository which contains number of useful packages that are not available in standard CentOS. Installing EPEL allows number of useful programs, daemons and utilities to be installed.
Install Maria DB Packages (Maria DB is a opensource database management system)
yum install git MariaDB-server -y
Check MariaDB is Actively running
To start Database
Systemctl start MariaDB
To Enable Database
Systemctl enable MariaDB
To check its running
Systemctl status MariaDB
MariaDB fully setup and actively running.
why we are creating Security.
Database hold confidential, sensitive or protected information making it prime target for cyberattacks.
if your intellectual property is stolen or leaked, you might struggle to maintain before this happen we will secure out database.
Time to setup security for MySQL
Mysql_seure_installation
set password for database, admin123 (I created this if you want you guys can give any password here but note this down)
Follow this steps when installing security
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Set Database name and user
Mysql -u root -p
Command meaning: Its simple way to execute Mysql command as a root user (-u root ) promoting for password -p is for password.
Create Database account
Mysql -u root -p Create database accounts;
Grant command:
Mysql -u root -p grant all privileges on accounts.* TO 'admin'@’%’ identified by 'admin123'
Meaning for this command :
The GRANT command is capable of applying a wide variety of privileges, everything from the ability to CREATE tables and databases, read or write FILES, and even SHUTDOWN the server. There are a wide range of flags and options available to the command.
Mysql -u root -p FLUSH PRIVILEGES;
Meaning for this command:
when we grant some privileges for a user, running the command flush privileges will reloads the grant tables in the mysql database enabling the changes to take effect without reloading or restarting mysql server.
Exit from Database and go to root user.
Download the source code to the root user
# git clone -b local-setup https://github.com/devopshydclub/vprofile-project.git
ls - to check the file or folder
cd vprofile-project
mysql -u root -padmin123 accounts <src/main/resources/db_backup.sql
mysql -u root -padmin123 accounts
To check Database is working fine
MySQL show tables;
Restart MariaDB server
Systemctl restart MariaDB
Config Firewall
Systemctl start firewalld
System enable firewalld
firewall-cmd --get-active-zones
firewalld-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
systemctl restart mariadb
These are the steps to install Mysql server.
Exit from the root user
logoutout from database server.
Now we need to see the output
ifconfig
you will get the ip address copy that, go to web browser
http://<paste that ip address>
you will be inside the login page
user name: admin_vp
Password: admin_vp
This will take you in.
NEXT WE GONNA DOWNLOAD MEMCACHE SERVER. Click the link below to Install. Memcached Server Setup