How to Install MySQL 5.5 Database on CentOS 6.2 using Remi Repository

MySQLRemi Repository or Les RPM de Remi repository is one of the popular 3rd party repositories for CentOS. (See http://rpms.famillecollet.com/) Remi repository provides and maintains the latest version of MySQL and PHP. Remi repository can be very useful
when you need the latest version of Linux Apache MySQL and PHP (LAMP) server. In this post, i will share on how to install MySQL 5.5 database on linux CentOS 6.2 using 3rd party repository, Remi repository.

Prerequisites :
How to Install Remi yum Repository on CentOS 6.2 x86 and x86_64

Simply run the following command to install latest MySQL Server packages :

[root@centos62 ~]# yum install mysql mysql-server -y
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * remi: rpms.famillecollet.com
 * remi-test: rpms.famillecollet.com
 * updates: centos.ipserverone.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.i686 0:5.5.25-1.el6.remi will be installed
--> Processing Dependency: mysql-libs(x86-32) = 5.5.25-1.el6.remi for package: mysql-5.5.25-1.el6.remi.i686
---> Package mysql-server.i686 0:5.5.25-1.el6.remi will be installed
--> Processing Dependency: libaio.so.1(LIBAIO_0.4) for package: mysql-server-5.5.25-1.el6.remi.i686
--> Processing Dependency: libaio.so.1(LIBAIO_0.1) for package: mysql-server-5.5.25-1.el6.remi.i686
--> Processing Dependency: libaio.so.1 for package: mysql-server-5.5.25-1.el6.remi.i686
--> Running transaction check
---> Package libaio.i686 0:0.3.107-10.el6 will be installed
---> Package mysql-libs.i686 0:5.5.25-1.el6.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                   Arch              Version                        Repository         Size
====================================================================================================
Installing:
 mysql                     i686              5.5.25-1.el6.remi              remi              5.8 M
 mysql-server              i686              5.5.25-1.el6.remi              remi               10 M
Installing for dependencies:
 libaio                    i686              0.3.107-10.el6                 base               21 k
 mysql-libs                i686              5.5.25-1.el6.remi              remi              771 k

Transaction Summary
====================================================================================================
Install       4 Package(s)

Total download size: 17 M
Installed size: 77 M
Downloading Packages:
(1/4): libaio-0.3.107-10.el6.i686.rpm                                        |  21 kB     00:00
(2/4): mysql-5.5.25-1.el6.remi.i686.rpm                                      | 5.8 MB     12:36
(3/4): mysql-libs-5.5.25-1.el6.remi.i686.rpm                                 | 771 kB     01:35
(4/4): mysql-server-5.5.25-1.el6.remi.i686.rpm                               |  10 MB     21:41
----------------------------------------------------------------------------------------------------
Total                                                               8.0 kB/s |  17 MB     35:56
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-libs-5.5.25-1.el6.remi.i686                                                1/4

WARNING : This MySQL RPM is not an official Fedora/Redhat build and it
overrides the official one. Don't file bugs on Fedora Project nor Redhat.
Use dedicated forums http://forums.famillecollet.com/

  Installing : mysql-5.5.25-1.el6.remi.i686                                                     2/4
  Installing : libaio-0.3.107-10.el6.i686                                                       3/4
  Installing : mysql-server-5.5.25-1.el6.remi.i686                                              4/4

Installed:
  mysql.i686 0:5.5.25-1.el6.remi                mysql-server.i686 0:5.5.25-1.el6.remi

Dependency Installed:
  libaio.i686 0:0.3.107-10.el6                  mysql-libs.i686 0:5.5.25-1.el6.remi

Complete!

Start the MySQL daemon service :

[root@centos62 ~]# service mysqld start
Starting mysqld:                                           [  OK  ]

Login to database :

[root@centos62 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.25 MySQL Community Server (GPL) by Remi

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit

Check existing MySQL installed related packages :

[root@centos62 ~]# rpm -qa | grep mysql
compat-mysql51-5.1.54-1.el6.remi.i686
mysql-libs-5.5.25-1.el6.remi.i686
mysql-5.5.25-1.el6.remi.i686
mysql-server-5.5.25-1.el6.remi.i686

Check mysql version :

[root@centos62 ~]# mysql -V
mysql  Ver 14.14 Distrib 5.5.25, for Linux (i686) using readline 5.1
[root@centos62 ~]#

How to Configure MySQL Database Server on Ubuntu 11.10

MySQLIn this post, i will share with you on how to perform basic configuration on MySQL database server on Ubuntu 11.10 linux. As we know, MySQL Server is the world’s most popular open source database and the most demanding Web’s database especially for blogging and to run web applications. Assumed that MySQL database has been installed successfully :

Steps Configure MySQL Database Server on Ubuntu 11.10:

1. Change its bind address. This is for security purpose. Skip this step if the applications and MySQ are running on the same machine.

ehowstuff@ehowstuff:~$ vim /etc/mysql/my.cnf

Original bind address :

bind-address           = localhost

Change to something like this :

bind-address            = 192.168.1.0

2. Set mysql root password
Type the following to access the database :

ehowstuff@ehowstuff:~$ mysql -u root

At mysql console, type the following to set the password :

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');

3. Show user info on the database name’s mysql :

mysql> select user,host,password from mysql.user;
+------------------+-----------------------+-------------------------------------------+
| user             | host                  | password                                  |
+------------------+-----------------------+-------------------------------------------+
| root             | localhost             | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root             | ehowstuff.example.com | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root             | 127.0.0.1             | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| debian-sys-maint | localhost             | *0D767A6F1808D25DDAFB4AE43C9BA83063C89ED5 |
+------------------+-----------------------+-------------------------------------------+
4 rows in set (0.00 sec)

Alternatively, you can run this :

mysql> select user,host,password from user;
+------------------+-----------------------+-------------------------------------------+
| user             | host                  | password                                  |
+------------------+-----------------------+-------------------------------------------+
| root             | localhost             | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root             | ehowstuff.example.com | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root             | 127.0.0.1             | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| debian-sys-maint | localhost             | *0D767A6F1808D25DDAFB4AE43C9BA83063C89ED5 |
+------------------+-----------------------+-------------------------------------------+
4 rows in set (0.00 sec)

How to Install MySQL Server on Ubuntu 11.10

MySQL ServerMySQL Server is the world’s most popular open source database. MySQL Database powers the most demanding Web, E-commerce and blogging tools. It has multi-threaded, multi-user, fast, robust SQL database server and intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. In this post, i will share on how to install MySQL Server on Ubuntu 11.10 server.

To install MySQL, run the following command on your putty or terminal :

ehowstuff@ehowstuff:~$ sudo apt-get install mysql-server

Example :

ehowstuff@ehowstuff:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16 libnet-daemon-perl
  libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server-5.1
  mysql-server-core-5.1
Suggested packages:
  libipc-sharedcache-perl libterm-readkey-perl tinyca mailx
The following NEW packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16 libnet-daemon-perl
  libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server mysql-server-5.1
  mysql-server-core-5.1
0 upgraded, 12 newly installed, 0 to remove and 79 not upgraded.
Need to get 22.5 MB of archives.
After this operation, 54.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main mysql-common all 5.1.62-0ubuntu0.11.10.1 [11.8 kB]
Get:2 http://sg.archive.ubuntu.com/ubuntu/ oneiric/main libnet-daemon-perl all 0.48-1 [43.1 kB]
Get:3 http://sg.archive.ubuntu.com/ubuntu/ oneiric/main libplrpc-perl all 0.2020-2 [36.0 kB]
Get:4 http://sg.archive.ubuntu.com/ubuntu/ oneiric/main libdbi-perl i386 1.616-1build1 [852 kB]
Get:5 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libmysqlclient16 i386 5.1.62-0ubuntu0.11.10.1 [1,805 kB]
Get:6 http://sg.archive.ubuntu.com/ubuntu/ oneiric/main libdbd-mysql-perl i386 4.019-1 [110 kB]
Get:7 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main mysql-client-core-5.1 i386 5.1.62-0ubuntu0.11.10.1 [88.3 kB]
Get:8 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main mysql-client-5.1 i386 5.1.62-0ubuntu0.11.10.1 [8,602 kB]
Get:9 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main mysql-server-core-5.1 i386 5.1.62-0ubuntu0.11.10.1 [4,632 kB]
Get:10 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main mysql-server-5.1 i386 5.1.62-0ubuntu0.11.10.1 [6,259 kB]
Get:11 http://sg.archive.ubuntu.com/ubuntu/ oneiric/main libhtml-template-perl all 2.10-1 [65.0 kB]
Get:12 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main mysql-server all 5.1.62-0ubuntu0.11.10.1 [6,406 B]
Fetched 22.5 MB in 3min 14s (116 kB/s)
Preconfiguring packages ...
Selecting previously deselected package mysql-common.
(Reading database ... 68437 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_5.1.62-0ubuntu0.11.10.1_all.deb) ...
Selecting previously deselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.48-1_all.deb) ...
Selecting previously deselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ...
Selecting previously deselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.616-1build1_i386.deb) ...
Selecting previously deselected package libmysqlclient16.
Unpacking libmysqlclient16 (from .../libmysqlclient16_5.1.62-0ubuntu0.11.10.1_i386.deb) ...
Selecting previously deselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.019-1_i386.deb) ...
Selecting previously deselected package mysql-client-core-5.1.
Unpacking mysql-client-core-5.1 (from .../mysql-client-core-5.1_5.1.62-0ubuntu0.11.10.1_i386.deb) ...
Selecting previously deselected package mysql-client-5.1.
Unpacking mysql-client-5.1 (from .../mysql-client-5.1_5.1.62-0ubuntu0.11.10.1_i386.deb) ...
Selecting previously deselected package mysql-server-core-5.1.
Unpacking mysql-server-core-5.1 (from .../mysql-server-core-5.1_5.1.62-0ubuntu0.11.10.1_i386.deb) ...
Processing triggers for man-db ...
Setting up mysql-common (5.1.62-0ubuntu0.11.10.1) ...
Selecting previously deselected package mysql-server-5.1.
(Reading database ... 68814 files and directories currently installed.)
Unpacking mysql-server-5.1 (from .../mysql-server-5.1_5.1.62-0ubuntu0.11.10.1_i386.deb) ...
Selecting previously deselected package libhtml-template-perl.
Unpacking libhtml-template-perl (from .../libhtml-template-perl_2.10-1_all.deb) ...
Selecting previously deselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.1.62-0ubuntu0.11.10.1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up libnet-daemon-perl (0.48-1) ...
Setting up libplrpc-perl (0.2020-2) ...
Setting up libdbi-perl (1.616-1build1) ...
Setting up libmysqlclient16 (5.1.62-0ubuntu0.11.10.1) ...
Setting up libdbd-mysql-perl (4.019-1) ...
Setting up mysql-client-core-5.1 (5.1.62-0ubuntu0.11.10.1) ...
Setting up mysql-client-5.1 (5.1.62-0ubuntu0.11.10.1) ...
Setting up mysql-server-core-5.1 (5.1.62-0ubuntu0.11.10.1) ...
Setting up mysql-server-5.1 (5.1.62-0ubuntu0.11.10.1) ...
mysql start/running, process 2687
Setting up libhtml-template-perl (2.10-1) ...
Setting up mysql-server (5.1.62-0ubuntu0.11.10.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

Enter Password
MySQL
Re-Enter the password for verification
MySQL

Once the installation is complete, the MySQL server should be started automatically. Check MySQL service :

ehowstuff@ehowstuff:~$ sudo netstat -tap | grep mysql
[sudo] password for ehowstuff:
tcp        0      0 localhost:mysql         *:*                     LISTEN      2687/mysqld
ehowstuff@ehowstuff:~$

If the server is not running correctly, run this command to restart the MySQL database :

ehowstuff@ehowstuff:~$ sudo /etc/init.d/mysql restart

Example :

ehowstuff@ehowstuff:~$ sudo /etc/init.d/mysql restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
mysql stop/waiting
mysql start/running, process 2853

Configure MySQL to listen for connections from allowed network, simply change the following to ip :

ehowstuff@ehowstuff:~$ sudo vi /etc/mysql/my.cnf
bind-address            = 192.168.1.0

Restart the MySQL database :

ehowstuff@ehowstuff:~$ sudo /etc/init.d/mysql restart

Example :

ehowstuff@ehowstuff:~$ sudo /etc/init.d/mysql restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
mysql stop/waiting
mysql start/running, process 2968