Process of Installing mysql on linux

Process of Installing mysql on linux you use two ways i.e RPM or Binaries

  • RPM installation – it is fast and simple installation The only drawback here is that
    MySQL is not installed into a single destination it’s install the several directories.
  • Installing binaries – downloading installation files from the mysql.com website, copying
    them into a directory of your choice, and doing some simple configuration.

Using RPM Installation of mysql:

Using RPM , it has contain two files:

  • MySql-server-type-VERSIONNUMBER.PLATFORM.rpm —-it is mysql server
  • MySql-client-type-VERSIONNUMBER.PLATFORM.rpm  —- it is mysql client libraries.

To perform a minimal installation from RPMs, you can type the following at your Linux prompt
i.e

shell> rpm – i > MySQL–server-5.0.51.i386.rpm or MySQL–client–5.0.51.i386.rpm

Now mysql installation will be started on linux..

Using Binaries Installation of mysql:

Another installation method is to install MySQL from binary. This method requires gunzip and tar files (files with .tar.gz extension) and also requires to create groups and users on the system.

1. If your system does not contain a user and group for mysql then u will create user and
groups as follows

shell> groupadd mysql 
shell> useradd -g mysql mysql

The above will create a user that has login permissions to your server.These commands add the mysql group and the mysql user.

2. Pick the directory under which you want to intsallation files and change location into it

shell> cd /usr/local

3. Unpack the distribution, which creates the installation directory. Then create a symbolic link to that directory:

shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - 
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

4. Change location into the installation directory:
shell> cd mysql

You will find several files and subdirectories in the mysql directory i.e for installation purposes
are the bin and scripts subdirectories:

  • The bin directory contains client programs and the server.
  • The scripts directory contains the mysql_install_db script. It is used to initialize
    the mysql database
  • mysql installation files are contains as root so change the owenership to mysql by using
    following commands.
shell> chown -R mysql
shell> chgrp -R mysql

The first command changes the owner attribute of the files to the mysql user. The second
changes the group attribute to the mysql group.

— If you have not installed MySQL before, you must create the MySQL data directory and
initialize the grant tables:

shell> scripts/mysql_install_db --user=mysql

this command runs as root, so change ownerships to root because data directory and it
contents with mysql as the owner.
After creating or updating the grant tables, you need to restart the server manually.

7. Most of the MySQL installation can be owned by root .this, run the following commands as
root in the installation directory:

shell> chown -R root
shell> chown -R mysql data

8. After everything has been unpacked and installed, To start the MySQL server, use the
following command:

shell> bin/mysqld_safe --user=mysql &

After starting the server, you should set up passwords. set the root password Now, before you do anything else, set root user’s password (!)

SELECT Host, User FROM mysql.user;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');

LEAVE A REPLY

Please enter your comment!
Please enter your name here

seven + 16 =