How to Install MySQL for Linux
The installation process of MySQL 5.6.x (community) on Linux, using the distribution from MySQL AB. if you’re using another flavor of UNIX, download appropriate files and follow the instructions included with the distribution.
The recommended installation method for MySQL is with RPM’s. There are several RPM’s that make up a full distribution, but for a minimal installation you need the following ;
- MySQL-server-VERSION.i386.rmp-The MySQL server.
- MySQL-client-VERSION.i386.rpm-The standard MySQL client programs.
To download these files, visit the MySQL 5.6.x download page at http://dev.mysql.com/downloads/mysql/ and find the “Linux x86 RPM downloads” section on the page (or IA64 or AMD64, depending on your architecture). When you click the download link for one of the packages, you will be taken to a page of mirror sites. Select the mirror site closest to you and download the files.
When the files are downloaded to your system, perform the minimal installation by typing the following at your prompt, replacing VERSION with the appropriate version number of your downloaded files:
#prompt> rpm -i MySQL-server-VERSION. i386.rpm MySQL-client-VERSION. i386.rpm
if the RPM method doesn’t work for you, you can also install MySQL from a binary distribution, with requires gunzip and tar to uncompress and unpack the distribution and also requires the capability create grous and users on the system,
in the first series of commands, you will add a group and a user and then unpack the distribution , as follows:
At the prompt, type groupadd mysql.
At the prompt, type useradd -g mysql mysql.
At the prompt , type cd/user/local.
At the prompt, type gunzip < /path/to/mysql-standard-VERSION-OS.tar.gz | tar xvf – .
To create a link with the shorter name, type In – mysql-VERSION-OS mysql.
change directories by typing cd mysql.
Once the distribution is unpack, the read me and install files will walk you through the remainder of the installation process for the version of MySQL you’ve chosen. In general, the next series of commands will be used:
Type scripts/mysql_install_db to run the MySQL install script.
Type chown -R root /user/local/mysql to change ownership of the mysql directory.
Type chown -R mysql /user/local mysql/data to change ownership of the mysql/data directory.
Type chgrp -R mysql /user/local/mysql to change the group of the mysql directory.
Type chown _R root /user/local/mysql/bin to change ownership of the mysql/bin directory.
If you have any problems during the installation of MySQL, the first place you should look is the “Problems and Common Errors”
Some Common Problems :
- Incorrect permission do not allow you to start the MySQL daemon. If this is the case, be sure you have change owners and groups to match those indicated in the installation instructions.
- If you see the message Access denied when connecting to MySQL, be sure you are using the correct username and password.
- If you see the message Can’t connect to server, make sure the MySQL daemon is running.