Tuesday, June 5, 2012

How to install and configure MySQL Database

Linux supports a number of different solutions for installing MySQL.
1. Install MySQL using RPM Package
2. Install MySQL using Native package manager
3. Install MySQL using Generic Binaries

If you are new to MySQL then i would recommend using RPM, otherwise install manually using Generic Binaries. The recommended way installing MySQL on PRM-based(RPM VsNative) Linux distribution is using RPM package.

Install MySQL using RPM PackageUse below command to see all files in an RPM package
$ rpm -qpl MySQL-server-VERSION.linux2.6.x86_64.rpm

Run the below command to install
$ rpm -i MySQL-server-VERSION.linux2.6.x86_64.rpm

The RPM installation creates a login account named mysql.

By default the RPM places the data under /var/lib/mysql directory and creates the appropriate entries in /etc/ini.d to start the server automatically at boot time.

MySQL Installation Layout for Linux RPM
/usr/bin - Client programs and scripts
/usr/sbin - The mysqld server
/var/lib/mysql - Log files, databases
/usr/share/info - Manual in Info format
/usr/share/man - Unix manual pages
/usr/include/mysql - Include (header) files
/usr/lib/mysql - Libraries
/usr/share/mysql - Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation
/usr/share/sql-bench – Benchmarks

Install My SQL using Native package managerThe native package installation will automatically take care of downloading and installing the software. Also it will take care of dependencies for MySQL Installation.

Use yum command to install MySQL.
# yum install mysql mysql-server mysql-libs mysql-server

An init script will be installed into /etc/init.d/mysqld, this script is used to stop and start the server. A configuration file will be created under /etc/mysql/my.cnf

Use below commands to Stop and Start MySQL service
# service mysql start
# service mysql stop

If you want to start MySQL server automatically during the boot run below command.
# chkconfig --levels 235 mysqld on

Here are some popular MySQL Download links

Download MySQL Community Serverhttp://dev.mysql.com/downloads/mysql/
Download MySQL Clusterhttp://dev.mysql.com/downloads/cluster/
Download MySQL Workbench GUI Toolhttp://dev.mysql.com/downloads/workbench/5.2.html
Download MySQL Proxyhttp://dev.mysql.com/downloads/mysql-proxy/
Download MySQL Connectorshttp://dev.mysql.com/downloads/connector/

Satishbabu Gunukulahttp://www.oracleracexpert.com/