Mysql Installation on Linux


Mysql RPM Installation
Here is the guide to complete installation of MySQL in CentOS/RedHat OS.

Pre-Check list:
i. Check Linux Version
     cat /var/proc/version
      (for centos)
ii.  uname -a 
iii. Check desk(file system) space
          df -h
1.     Create one directory for Mysql packages  and enter into that directory as mentioned below
mkdir mysqlSoftwares      -- To create Folder
cd  mysqlSoftwares         -- To enter into directory


  

2.     Download Mysql RPM Packages from MySql official website
Click here for Mysql wesite
a.     Choose Product version, Operating System, machine(64bit or 32bit)  and Right click on Download option copy link address




b.     Use below command to download in terminal
wget <paste link here>



3.     Extract the rpm package
tar –xvf <mysq_package.tar>



 we will get following files


4.     Before installing check Mariadb files in system
rpm –qa|grep –i mariadb     -- To check mariadb files
if we got any any files here, please uninstall Mariadb files
rpm –e <mariadbfile> --nodeps   -- To uninstall Mariadb


5.     Install each rpm package
rpm  –ivh <file.rpm> --nodeps

rpm -ivh mysql-community-client-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-devel-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-common-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-embedded-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-embedded-devel-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-embedded-compat-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-libs-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-libs-compat-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-minimal-debuginfo-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-community-test-5.7.20-1.el7.x86_64.rpm –nodeps





6.      Verify
Use following command to verify all packages
rpm –qa|grep –i mysql



Check all packages are installed or not
7.      Start mysql Server
systemctl  start mysqld
and check status of mysql server
systemctl  status mysqld




8.      Find out Default root Password
 grep 'temporary password' /var/log/mysql/mysqld.log




9.      Login to Mysql server and create new root password
a.      Login to server using below command
mysql –u root –p
After that it will ask password
Type above temporary password

b.      Set new password for root user
set password for ‘root’@’localhost’=password(‘Root@123’);


10.                        After installation update my.cnf file
a.       Stop the server  
systemctl stop mysqld
b.      Take my.cnf backup
cp /etc/my.cnf  /etc/my.cnf_bkp
c.       Open my.cnf file
Vi  /etc/my.cnf
I.                    Type i    -- to enter into insert mode
II.                  Add global variables here
Innodb_buffer_pool_size=1024MB    #Increase upto 80% of RAM
max_connections=10000
max_allowed_packet_size=128M
innodb_print_all_deadlocks=ON
lower_case_table_names=1

III.                Save file
Press ESC button
Type   :wq!
Press Enter
:q!  --To unsave
d.      Start server
systemctl start mysqld







Sample my.cnf file
 



Comments

Popular Posts