Friday, July 8, 2011

How to Create Database in Mysql

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

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