From mysql shell using SQL queries

Login to mysql root user shell using the password redhat
# /usr/local/mysql/bin/mysql -u root -p
To list the databases in the connected server
To create a database ‘testdb’
mysql> create database testdb;
To use the database for adding tables
mysql> use testdb;
To create first table “users” with id ( INT ) and name ( VARCHAR ) fields
mysql> create table users(id INT(5),name VARCHAR(25)) ;
To create table “modules” with name ( VARCHAR ) and date ( DATE ) fields
mysql> create table modules(name VARCHAR(25),date DATE);
To check whether the tables added or not
mysql> show tables;
Exit from mysql server
mysql> exit

Leave a Reply

Your email address will not be published. Required fields are marked *