How to install Mysql Database Server on Redhat Linux

In this article I’m going to show you how to Install MySQL Database Server step by step on Redhat Linux.

For the MySQL database installation, we have required MySQL rpm files. You can find out these rpm files from your OS CD or from your YUM repository.

If YUM server not configured on your machine, click here and check how to configure yum server.

Install MySQL Database Server

For RHEL 5 and 6 use following command as Root user.

#yum install mysql-server mysql

For RHEL 3 and 4 use the following command as root user.

#up2date mysql-server mysql

How to start the MySQL server

After installing the above rpm start the MySQL servers using the following commands.

#chkconfig mysqld on
#/etc/init.d/mysqld start

Now make a password for root user of MySQL using the following command.

#mysqladmin -u root password yourpassword

Now check the MySQL connection using the following command.

# mysql -u root -p

Now we need to configure MySQL  Server, add the following settings in “/etc/my.cnf” file, you must remember the following values are sample values, set them as per your requirements.

#mysql settings
query_cache_type = 1
query_cache_limit = 1M
query_cache_size = 32M

# For MyISAM buffer size and recover options
key_buffer_size = 24M
myisam_recover = FORCE,BACKUP

# LOGGINGS for slow query
log_queries_not_using_indexes = 1
slow_query_log = 1
slow_query_log_file = /var/lib/mysql/mysqld-slow-query.log

#cache and other limits

tmp_table_size = 32M
max_heap_table_size = 32M
max_connections = 500
thread_cache_size = 50
open_files_limit = 65535
table_definition_cache = 4096
table_open_cache = 512

Save the above file and restart or reload the MySQL service using the following commands.

#/sbin/service mysqld restart 


#/sbin/service mysqld reload

Create Database and check it using the following command.

#mysql -u root -p
mysql> create database ocpgroup;
mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| ocpgroup           |
| test               |
4 rows in set (0.00 sec)

If you enjoyed this article, Please write in comment box about this article.

1 thought on “How to install Mysql Database Server on Redhat Linux”

Leave a Comment

%d bloggers like this:
Enable Notifications    OK No thanks