How to install MySQL in RHEL

How can I install MySQL on my server?

Edit test

Installing MySQL on Linux/UNIX
The recommended way to install MySQL on a Linux system is via RPM. MySQL AB makes the following RPMs available for download on its web site:

MySQL - The MySQL database server, which manages databases and tables, controls user access, and processes SQL queries.

MySQL-client - MySQL client programs, which make it possible to connect to and interact with the server.

MySQL-devel - Libraries and header files that come in handy when compiling other programs that use MySQL.

MySQL-shared - Shared libraries for the MySQL client.

MySQL-bench - Benchmark and performance testing tools for the MySQL database server.

The MySQL RPMs listed here are all built on a SuSE Linux system, but they’ll usually work on other Linux variants with no difficulty.

Now, follow the following steps to proceed for installation:

Login to the system using root user.

Switch to the directory containing the RPMs:

Install the MySQL database server by executing the following command. Remember to replace the filename in italics with the file name of your RPM.

[root@host]# rpm -i MySQL-5.0.9-0.i386.rpm
Above command takes care of installing MySQL server, creating a user of MySQL, creating necessary configuration and starting MySQL server automatically.

You can find all the MySQL related binaries in /usr/bin and /usr/sbin. All the tables and databases will be created in /var/lib/mysql directory.

The simplest way to install mysql is

yum install mysql-server

after that start the service by using

/etc/init.d/mysqld start

after starting the service for changing the for changing the root password and secure installation

/usr/bin/mysql_secure_installation

if you are using iptables just add the rules for iptables

iptables -I INPUT -p tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT

iptables-I OUTPUT -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT