BIOS,Windows, Linux, Software,Security, Domains, Web Hosting

Yum Install MySQL on CentOS

We cam use yum command to install mysql on CentOS, Redhat, but if your Redhat is not registered, you can not install software packages with yum online, but you can install them by using offline packages or Redhat installation DVD. This article we will see how to install mysql on CentOS.

1. Yum install mysql

Execute these commands in your command prompt:

yum install mysql
yum install mysql-server
yum install mysql-devel

2. Modify group permissions

Normally, mysql will be installed in /var/lib, please make sure the path below is correct for your CentOS.

chgrp -R mysql /var/lib/mysql
chmod -R 770 /var/lib/mysql

3. Modify mysql password

Starting mysql must be done at first. 

service mysqld start

Run these commands in your mysql control panel, and here we set root password as "new_password".

mysql -u root -p
//Here type your password and press enter
USE mysql;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');

See also: Change root or user password on MySQL

4. Open 3306 port on firewall

/sbin/iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

For RedHat/CentOS, save changes.

/etc/init.d/iptables save


Usage of /etc/init.d/iptables:

/etc/rc.d/init.d/iptables {start|stop|restart|condrestart|status|panic|save}

5. Setting mysql startup 

chkconfig --levels 345 mysqld on

Related Articles


Leave a Reply

Subscribe to BootBeta Comments RSS feed to receive notification of latest comments posted.


  • Enter Email Address:

Recent Post

Copyright@ 2010-2014 Bootbeta All Rights Reserved.
HooBlog Ver 1.5 Build 20140530