Create Mysql Database in Linux Command Line


How to Create Database in MySQL in Linux Command Line
MySql DB Creation Procedure for RedHat Fedora Ubuntu Cent OS Debian Linux

Mysql Database in Command Line

Login to your MySQL server through console remote shell (putty)

Example : If you want to create a database name = mytestdb and grant permission for user = testuser with password = testpasswd
database name = mytestdb
User Name = testuser
Password  = testpasswd

 #mysql -u root -p ( enter the mysql root password)
 mysql> create database mytestdb;
 mysql> grant all privileges on mytestdb.* to testuser@localhost identified by 'testpasswd';
 mysql> FLUSH PRIVILEGES;
 mysql>show databases;
 mysql> exit 

This will create mytestdb and enable access for testuser form localhost
If you want to connect mysql form remote server, then replace localhost with your remote server ip