Tuesday, December 8, 2015

Install MySQL Database Server on CentOS

MySQL database server MySQL is a RDBMS that is stand for relational database management system.MySQL has more than 11 million installations. The program runs as a server providing multi-user access to a number of databases and most advanced updated SQL features.

This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo.


Step-I (Installation of MySQL & MySQL Server)
# yum install mysql-server mysql
Step-II (Configure MySQL Configuration Files)
# vi /etc/my.cnf
[mysqld]
default-character-set=utf8
Step-III (Starting of mysqld daemon)
on normal mode
# /etc/init.d/mysqld start
on safe mode
# cd /usr
# /usr/bin/mysqld_safe &
Step-IV (Test the MySQL daemon with the benchmarks in the ‘sql-bench’ directory)
# cd sql-bench
# perl run-all-tests
Step-V (Set a mysqladmin root password)
# /usr/bin/mysqladmin -u root password 'new-password'
# /usr/bin/mysqladmin -u root -h techbrown.com password 'new-password'
Step-VI (Check MySQL Address)
# netstat -anp |grep mysql
# ps -ef |grep mysql
Step-VII (Starting of MySQL Shell)
As a normal user
# mysql
Enter password:
mysql>
As a root user
# mysql -u root -p
Enter password:
mysql>
Step-VIII (Remove MySQL Password)
# /etc/init.d/mysqld stop
# mysqld_safe --skip-grant-tables &
# mysql
mysql> use mysql;
mysql> update user set Password= ‘ ’ where User=‘root’;
mysql> commit;
mysql> flush privileges;
mysql> quit;
# /etc/init.d/mysqld restart
# mysql
mysql>
Step-IX (See the MySQL Database)
mysql> show databases;
Step-X (Change the MySQL Database)
mysql> use mysql;
Database changed
Step-XI (See the MySQL Database Table)
mysql> show tables;
Step-XII (See the MySQL Database Function)
mysql> describe func;
Step-XIII (User Queries in MySQL Database)
mysql> select * from user
mysql> select Host,User,Password from user;
mysql> select Host,User,Password from user where user='root';
Step-XIV (Create a MySQL Database)
mysql> create database techbrown_db;
Step-XV (Create a MySQL Database Table)
mysql> use techbrown_db;
Database changed
mysql> create table techbrown_table(name VARCHAR(15),email VARCHAR(15),phone_number INT,ID INT NOT NULL AUTO_INCREMENT,primary key(ID));
mysql> show tables ;
Step-XVI (Inserting Information into MySQL Database)
mysql> select * from techbrown_table;
mysql> insert into techbrown_table (name,email,phone_number)values("rithy","rithy@gmail.com",0123456789);
mysql> select * from techbrown_table;
Step-XVII (Deleting Information into MySQL Database)
mysql> delete from techbrown_table where phone_number=0123456789;
mysql> select * from techbrown_table;
Step-XVIII (Exit from MySQL Shell)
mysql> exit
Congratulation now you have completed MySQL Database Server Configurations.

No comments:

Post a Comment