Tuesday, March 10, 2015

Installing MySQL Server through Binaries in Linux.

To install and use a MySQL binary distribution, the command sequence looks like this:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /data
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
Create a mysql User and Group.
First we are going to create a group of mysql in the new server, adding a new user of mysql to server so that we will connect to the mysql by using the above username.
shell> groupadd mysql
shell> useradd -r -g mysql mysql
Obtain and Unpack the Distribution
Select directory under which you want to unpack the distribution and change location into it. The example here unpacks the distribution under /data. The instructions, therefore, assume that you have permission to create files and directories in /data. If that directory is protected, you must perform the installation as root.
shell> cd /data
Unpack the distribution, which creates the installation directory. Then create a symbolic link to that directory.tar can uncompress and unpack the distribution if it has z option.
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
Provide the Right to the Folder:
After unpacking the data to the folder. Now we have to give the permissions to the folder.
shell> chown -R mysql .
shell> chgrp -R mysql .
Installing MySQL DB.
We are going to install the MySQL DB i.e. by the below command. so the database and relevant contents will be created in the folder.
shell> scripts/mysql_install_db --user=mysql
Now give the mysql user rights to the folder so that we can access the MySQL Server. And it can be used for creating the databases on the server.

No comments:

Post a Comment