How install MySQL server in 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 the YUM server is not configured on your machine, click here and check how to configure the yum server.

How install MySQL server step by step?

Install MySQL Database Server

For RHEL 5 and 6 use the following command as the root user.

#yum install mysql-server mysql

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

#up2date mysql-server mysql

How do I start MySQL on Redhat Linux?

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 the 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 a 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 the comment box about this article.

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

Leave a Comment