Sometimes old version of MySQL Server is required for smooth operation of old application. For that first clean up your existing MySQL installation.
Step 1. Stop the MySQL service
[root@localhost ~]# sudo systemctl stop mysqld.service
Step 2. List all installed MySQL packages on your system
[root@localhost ~]# rpm -qa | grep mysql
This command will list all installed MySQL packages on your system. E.g. mysql-libs-8.0.15-3.el7._5.x86_64
Step 3. Remove the installed package one by one:
# yum remove < name displayed in Step 2 >
Eg.
[root@localhost ~]# yum remove mysql-libs-8.0.15-3.el7._5.x86_64
Step 4. Enable required version for installation
Now you can install any version of MySQL Server on CentOS. In this case MySQL 5.5 . For that, Enable the MySQL 5.5 Community version repository using below yum install
command.
root@localhost ~]# yum install http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm
Step 5: Install MySQL
Once repo is enabled, run yum install -y mysql-community-server
to install MySQL Server as shown below.
root@localhost ~]# yum install -y mysql-community-server
Step 6: Check if it is installed properly using rpm tool
After successful installation of all the MySQL packages you can verify
the installation by querying the package details from RPM DB using rpm -qa | grep -i mysql-community
command as shown below. It will show all the installed packages in the RPM Database.
root@localhost ~]# rpm -qa | grep -i mysql-community
Step 7: Start MySQL Service
Now start the MySQL server using the command
root@localhost ~]# systemctl start mysqld.service
Step 8: Setting Up MySQL Server Using mysql_secure_installation
This is very important step where you need to configure the Server credentials using mysql_secure_installation
utility before login to the Database and set the other important options as well to secure the database.
root@localhost ~]# sudo mysql_secure_installation
After performing above step you need to again restart the server either using systemctl restart mysqld
or service mysqld restart
command as shown below.
[root@localhost ~]# systemctl restart mysqld
Step 9: Login to MySQL
After setting the root user credentials you can try to login to the MySQL Server using command
[root@localhost ~]# mysql -u root -p
You can use -u
option to specify the User Name and -p
option to specify the User Password. This is the same password which
you have set in Step 8.
0 comments:
Post a Comment