Install MySQL 5.5.21 on RHEL/CentOS and Fedora

MySQL is a open source relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It allows user to create a relational database structure on a web-server in order to store data or automate procedures. MySQL is free and released under GNU (General Public License). In this guide I will teach on how to install or upgrade MySQL 5.5.21 on RHEL, CentOS and Fedora distributions.

Install MySQL 5.5.21 in Linux


Important : I suggest you'll to take backup of all your databases, before upgrading your existing MySQL database. If something goes wrong while upgrading or installing new MySQL 5.5.21, then at least you can revert it back by dumping all your databases. Let's first take a backup of all existing databases with below commands. It is just for your safety. (Optional)

Take All MySQL Database Backup

1. To dump all your MySQL databases issue following command.
mysqldump -u root --all-databases --single-transaction --master-data=1 > masterdump.sql
2. To import all your MySQL databases use below command.
mysql -u root -p < masterdump.sql

Install MySQL Database 5.5.21 on RHEL 6.2/6.1/6/5.8/5.7, CentOS 6.2/6.1/6/5.8/5.7, and Fedora 16/15/14/13/12

Step 1: Installing Remi Repository

We required Remi Repository for MySQL 5.5.21 installation on RHEL, CentOS and Fedora.

On Fedora 15/14/13/12

## Remi Dependency on Fedora 15, 14, 13, 12, 11, 10, 9, 8 ##
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
 
## Fedora 15 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm
 
## Fedora 14 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm
 
## Fedora 13 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-13.rpm
 
## Fedora 12 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-12.rpm
Important : Currently extra repos are not needed on Fedora 16.

On RHEL/CentOS 6.2/6.1/6/5.8/5.7

## Remi Dependency on CentOS 6 and RHEL 6 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
 
## CentOS 6 and RHEL 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
  
## Remi Dependency on CentOS 5 and RHEL 5 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
 
## CentOS 5 and RHEL 5 ## 
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Step 2: Installing or Upgrading MySQL 5.5.21

On Fedora 15/14/13/12
yum install --enablerepo=remi mysql mysql-server
On RHEL/CentOS 6.2/6.1/6/5.8/5.7
yum install --enablerepo=remi mysql mysql-server

Step 3: Starting MySQL 5.5.21 Server

To start newly installed MySQL Server 5.5.21 on RHEL 6.2/6.1/6/5.8/5.7, CentOS 6.2/6.1/6/5.8/5.7, and Fedora 15/14/13/12, issue below command.
## Start MySQL Server ##
/etc/init.d/mysqld start

## OR ##
service mysqld start

On Fedora 16
systemctl enable mysqld.service

Step 4: Connecting MySQL 5.5.21 Server

To connect MySQL database issue following command.
## Connect to MySQL Server ##
mysql -u root -p

## OR ##
mysql -h localhost -u root -p

That's it you're done.....

2 comments:

  1. Thanks for the article well presented..

    ReplyDelete