How to Install MySQL Server on CentOS 5.8

Share this Article :

In this post, i will show on how to install MySQL database server on linux CentOS 5.8 server. MySQL server is a database server that can stores and retrieves data for the blog, websites and applications. It is one of the most popular most used in the internet especially for content management and blogging site. MySQL is a Relational Database Management System (RDBMS) that runs as a server providing multi-user access to a number of databases. For more information on MySQL, you can visit their website at www.mysql.com.

First of all, to install mysql server, you can simply execute this command :

[[email protected] ~]# yum install mysql-server -y

Examples :

[[email protected] ~]# yum install mysql-server -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.oscc.org.my
 * extras: mirror.issp.co.th
 * updates: mirror.issp.co.th
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i386 0:5.0.95-1.el5_7.1 set to be updated
--> Processing Dependency: mysql = 5.0.95-1.el5_7.1 for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: perl(DBI) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: mysql-server
--> Processing Dependency: perl-DBI for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15 for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-server
--> Running transaction check
---> Package mysql.i386 0:5.0.95-1.el5_7.1 set to be updated
---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated
---> Package perl-DBI.i386 0:1.52-2.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                    Arch             Version                      Repository           Size
====================================================================================================
Installing:
 mysql-server               i386             5.0.95-1.el5_7.1             updates             9.8 M
Installing for dependencies:
 mysql                      i386             5.0.95-1.el5_7.1             updates             4.9 M
 perl-DBD-MySQL             i386             3.0007-2.el5                 base                148 k
 perl-DBI                   i386             1.52-2.el5                   base                600 k

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

Total download size: 15 M
Downloading Packages:
http://mirror.oscc.org.my/centos/5.8/os/i386/CentOS/perl-DBD-MySQL-3.0007-2.el5.i386.rpm: [Errno 12] Timeout: 
Trying other mirror.
(1/4): perl-DBD-MySQL-3.0007-2.el5.i386.rpm                                  | 148 kB     00:01
(2/4): perl-DBI-1.52-2.el5.i386.rpm                                          | 600 kB     00:12
(3/4): mysql-5.0.95-1.el5_7.1.i386.rpm                                       | 4.9 MB     02:36
(4/4): mysql-server-5.0.95-1.el5_7.1.i386.rpm                                | 9.8 MB     03:48
----------------------------------------------------------------------------------------------------
Total                                                                37 kB/s |  15 MB     07:09
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-DBI                                                                     1/4
  Installing     : mysql                                                                        2/4
  Installing     : perl-DBD-MySQL                                                               3/4
  Installing     : mysql-server                                                                 4/4

Installed:
  mysql-server.i386 0:5.0.95-1.el5_7.1

Dependency Installed:
  mysql.i386 0:5.0.95-1.el5_7.1   perl-DBD-MySQL.i386 0:3.0007-2.el5   perl-DBI.i386 0:1.52-2.el5

Complete!

Note : MySQL server service daemon is mysqld.

To check Mysqld status :

[[email protected] ~]# service mysqld status
mysqld is stopped

Start MySQL service :

[[email protected] ~]# service mysqld start

Start MySQL service at first time :

[[email protected] ~]# service mysqld start
Initializing MySQL database:  WARNING: The host 'centos58.ehowtuff.local' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h centos58.ehowtuff.local password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                           [  OK  ]
Starting MySQL:                                            [  OK  ]

Stop MySQL service :

[[email protected] ~]# service mysqld stop

Make mysqld daemon start at boot :

[[email protected] ~]# chkconfig mysqld on

Leave a Reply