MySQL Installation

While you have a basic idea about MySQL, I would recommend the real-time trial and error than just reading out.
For that, download a latest stable community version of MySQL from the official website.
Though MySQL is platform independent, its best suited for Linux/Unix environment.
So, better have Linux on VM and install MySQL.
(All my posts mostly will be based on the same combination.)
There are many ways to install MySQL on your Linux, based on its flavor. You may go for RPM installation or Binary installation  by downloading files, manually.
Apart from that, you can get MySQL inbuilt in some of the Linux versions, if not, you can get it easily by updating the library(apt-get, yuminstallations)
Ubuntu:
sudo apt-get install mysql-server
Non-Ubuntu:
sudo yum install mysql-server
However, I prefer RPM way of installation. Just download MySQL stable Community edition RPM from official website.
Make sure, you download both MySQL server and MySQL client RPMs.
MySQL Server – It is the actual MySQL software, which can be installed on any host.
MySQL Client – It is the client to connect to any MySQL server. Means, without this you can’t access any MySQL server. While, this can be installed on any of the server through which you can access any MySQL server.

Here are the steps to install MySQL through RPMs:

* First of all download Server and Client RPMs.
You can download the latest GA release from MySQL site or version you want from Oracle e-delivery.Below are the RPMs, I downloaded:

[root@localhost Desktop]# ls -lhrt
total 70M
-rwxrw-rw-. 1 theray theray 52M Feb 12 05:14 MySQL-server-5.6.16-1.el6.x86_64.rpm
-rwxrw-rw-. 1 theray theray 18M Feb 12 05:14 MySQL-client-5.6.16-1.el6.x86_64.rpm

* Make sure that there is not previously installed MySQL, using the below command :

[root@localhost Desktop]# rpm -qa | grep -i mysql
mysql-libs-5.1.47-4.el6.x86_64

If already there, us below command to remove it:

[root@localhost Desktop]# rpm -e rpm_package_name


* Install RPMs:

[root@localhost Desktop]# ls -lrht
total 70M
-rwxrw-rw-. 1 theray theray 52M Feb 12 05:14 MySQL-server-5.6.16-1.el6.x86_64.rpm
-rwxrw-rw-. 1 theray theray 18M Feb 12 05:14 MySQL-client-5.6.16-1.el6.x86_64.rpm

–Installing Client:

[root@localhost Desktop]# rpm -ivh MySQL-client-5.6.16-1.el6.x86_64.rpm
Preparing…                ########################################### [100%]
1:MySQL-client           ########################################### [100%]

–Installing Server:

[root@localhost Desktop]# rpm -ivh –force MySQL-server-5.6.16-1.el6.x86_64.rpm
Preparing…                ########################################### [100%]
1:MySQL-server           ########################################### [100%]
2014-02-12 05:39:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2014-02-12 05:39:06 32621 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-02-12 05:39:06 32621 [Note] InnoDB: The InnoDB memory heap is disabled
2014-02-12 05:39:06 32621 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
.
.
.

* Now, create /etc/my.cnf file(its the basic configuration file) with the necessary configurations in it:

[root@localhost Desktop]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

* Start MySQL process :

[root@localhost Desktop]# /etc/init.d/mysql start
Starting MySQL…………………………………………………………………………………………
………. SUCCESS!

* Once its started, use the below command to remove anonymous users and make the installations secure:
[root@localhost Desktop]# /usr/bin/mysql_secure_installation
Now the MySQL is ready for use!

  • Ask Question