You are on page 1of 12

Installation of Mysql on Red Hat Linux 5.

1 with snapshots
Prepared by Vikas Shukla

Friends, I have done this on VMWare. But the Procedures are similar. Enjoy

1. First, s witch as the root user, so that you could change the ownerships and install the files without any problem.

2. Now add a group Sql and then add mysql user to the group sql by following commands: Groupadd sql Useradd –g sql mysql

3. Now select the path whe re you want to create the data file, which is normally /us r/local

4. Now create the Data file with the name Mysql and enter the data file.

5. Now uncompress the tar.gz file that you have downloaded from the website. Make sure that the path is the same where you want the installation to be. Uncompress it using the following commands. Tar –zxvf /usr/local/mysql /home/oracle/Desktop/mysql-5.1.56.tar.gz

6. Make sure that there are the pre-requisites fulfilled i.e proper ve rsions of gcc and flex are available in then linux.

6. Change location into the top-level directory of the unpacked distribution: shell> cd mysql-VERSION

Note that currently you must configure and build MySQL from this top-level directory. You cannot build it in a diffe rent directory. 7. Configure the release. shell> ./configure --prefix=/usr/local/mysql

The screen looks like this when the sql configuration process is completed.

8. Compile the release now. Shell> make After running the make command the screen looks like this:

9. Install the distribution:
shell> make install

While the make install command is run, the screen appears like this:

10. Copying my.cnf file

Change location into the installation directory:
shell> cd /usr/local/mysql

If you haven't installed MySQL before, you must create the MySQL grant tables:
shell> bin/mysql_install_db --user=mysql

11. Change the owners hip of program binaries to root and owne rship of the data directory to the user that you run mysqld as. Assuming that you are located in the installation directory (/usr/local/mysql), the commands look like this:
shell> chown -R root . shell> chown -R mysql var shell> chgrp -R mysql .

12. After everything has been installed, you should test your distribution. To start the MySQL server, use the following command: shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &

13. Now you can start mys ql by running mys ql in /usr/local/mysql/bin by typing Shell> mysql or ./Mysql

Now you can see the databases already provided to you by the command Show databases. The screen will appear like this:

14. If you restart the linux, it may happen that it may not start automatically, so we have the following solution: As we know every user in linux has a personal bash profile. So we can edit this bash_profile file by Vi editor and export the path of the folder whe re the executable file mysql and other file is available. The command to edit the bash profile is: vi .bash_profile

Here we add the bin folder of the Mysql directory whe re each executive files of the Mysql configuration lies. This means that the user whose bash profile is changed whe n logged in, will see for the executables files in the directories which has been listed in the PATH segment of the bash Profile.

So, when logged in next time, we can directly run mysqld and then the Mysql prompt without any problem.

THANKS.