MySQL on CentOS
From DTO Labs Knowledge Base
The easiest way to get the MySQL database server installed on CentOS is to use the version included in the distribution.
Setup
- Install the MySQL server using Yum:
[root@ip-10-176-57-29 ~]# yum -y install mysql-server . . . Running Transaction Installing : mysql 1/3 Installing : perl-DBD-MySQL 2/3 Installing : mysql-server 3/3 Installed: mysql-server.x86_64 0:5.0.77-4.el5_4.2 Dependency Installed: mysql.x86_64 0:5.0.77-4.el5_4.2 perl-DBD-MySQL.x86_64 0:3.0007-2.el5 Complete!
- Make sure the server will be up when you want it!:
[root@ip-10-176-57-29 ~]# chkconfig --level 2345 mysqld on [root@ip-10-176-57-29 ~]# chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- Start MySQL:
[root@ip-10-176-57-29 ~]# service mysqld start Starting MySQL: [ OK ]
Test
- Connect to the database from a root shell on the same system:
[[root@ip-10-176-57-29 ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.77 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> Bye