Installation of mysql server/client on CENT OS(Linux)


download latest mysql rpm for client/server(community) from below address.
Select the platform , Generic Linux
Select package of 32 bit/64 bit as per your requirement.

Installation Steps

Step# 1 : login with root user(OS) , via ssh/putty
Step# 2 : check previous version of mysql is installed on server , if yes hen need to remove first.

– To check previous version exists or note
rpm –qa | grep –i mysql
– To remove the previous version (remove all server/client of mysql)
rpm -e –nodeps –allmatches mysqlclient10-3.23.58-4.RHEL4.1

Step# 3 : Install /client/development rpm as shown in below command.

rpm -ivh MySQL-server-comxxxxx.rpm MySQL-client-commxx.rpm
rpm -ivh MySQL-devel-community-xxxxx.rpm

Note : if server install successfully then it will show the server started [OK] in verbose. if you found any policy related error please follow below steps.

– Edit file /etc/selinux/targeted/src/policy/domains/program/mysqld.te and Add below 2 Lines
allow mysqld_t random_device_t:chr_file read;
allow mysqld_t urandom_device_t:chr_file read;

– go to /etc/selinux/targeted/src/policy and fire below command.
make load
– once it done please restart the mysql service by below.
service mysql start

Step# 4 : change the administrator password of mysql (root) user.

/usr/bin/mysqladmin -u root password ‘specmysql123’

Post Installation Steps.

Step# 1 Verify the mysql installation by below command.

mysql –V

Step# 2 :  Execute below script with admin user of mysql (if old package was installed on your system).

$ cd /usr/bin/mysql_upgrade -p

Step# 3 Verify the mysql by connecting it .

mysql -u root -p

Step# 4  it show the below command prompt

mysql > use test;
mysql > show tables;

Grant remote access for mysql on CENT OS(Linux)


Mysql server must be installed and should be running without any error.

Execution Steps.

Step# 1 : locate my.cnf file on PATH /etc/my.cnf
Note :  if you didn’t find any my.cnf file on above path then don’t worry, mysql might be run on default configuration file ,  so you need to create your my.cnf ( configuration file ) from the default file. search the default file from below command.(or you will get it from (/usr/share/mysql).

# find ./ -nane ‘my-large.cnf’  -print

my-large.cnf     # for large database.
my-medium.cnf  # for medium size database.
my-small.cnf     # for small database.

Step# 2 : Edit one of the above file as per your database requirement, and do below necessary changes in it [mysqld] section.

a)    Remove or comment the “skip-networking” parameter.
b)    Add the line “ bind-address= <<your Server IP>> “
c)    “ log_bin_trust_function_creators=1 ”
Your file should like as per below.


Save the file on path /etc with name “my.cnf” and restart the server.
/etc/init.d/mysql restart
If  in any case mysql server is not starting correctly then please check the log file <<server-Name>>.err on below PATH.

Step# 3 :  allow the Network IP or domain specific allow to access the mysql

–  Connect with admin user.
mysql  -u root –p
–   create new database and user that access the remotely.
mysql > create database sample;
mysql> GRANT ALL PRIVILEGES ON sample.* TO test1@’11.31.51.%’ IDENTIFIED BY ‘test1’;
Note here you can specify the one IP  or domain as per below
Valid options
‘’ , ‘’, ‘’,’10.11.20.%’,’’ etc..

Step#  4  :   Open port 3306 on centos so every one can access , (by pass from firewall).

–  Connect via root user.
#  iptables -A INPUT -i eth0 -p tcp –destination-port 3306 -j ACCEPT
#  sevice iptables save

Step#  5  :  restart the mysql server

service mysql start

Post Execution.

Step 1 :  check the port 3306 is open or note via telnet.

telnet  <<Server_IP>>  3306.

Step 2 :  check the mysql by connecting remotely.

Written by SPECIndia

SPEC INDIA is a ISO 9001:2008 software solutions company based in Ahmedabad, India. Starting its journey in 1989 with just three professionals, SPEC INDIA has grown in revenue and human resource strength by building information bridges between technology and business processes.