MySQL is a Open source database management systems. It ‘s a powerful database management system with a lot of flexibility. This tutorial covers basic introduction to MySQL. In this tutorial I’m using Centos operating system for installing MySQL.
Installing MySQL in centos
MySQL can be installed using yum repository, and can be installed using the below comment.
#yum install mysql-server
Once the installation is complete, you can start mysql using the below comment.
No password is set by default during MySQL installation.
For setting up password for MySQL for the first time use mysqladmin to set root password
mysqladmin -u root password NEWPASSWORD
eg: mysqladmin –u root password Password123
Accessing MySQL Shell
MySQL prompt can be accessed using the below command
#mysql –u root –p
and enter the MySQL password created.
Now we are in MySQL prompt.
How to list databases?
type ‘show databases’ at mysql prompt.
How to create a database?
Syntax: create database <dbname>
How to access a database?
Syntax: use <dbname>
How to delete a database?
Syntax: drop database <dbname>