Monday 30 December 2013

MYSQL Management commands



  MYSQL Management commands

   Use MySQL client connecting to MySQL server.

#mysql –u [user-id] –h [hostname/IP] –p
*****
By default, without hostname, it will be localhost.

   Basic database information checking commands.

#show databases //list all available database; 
#connect [db-name]
#use [db-name]


   Create and delete db

#create database [dbname]
#drop database [dbname]


   Create , list and delete tables;

#create table [tablename] (field definition;)       //create the table;
#drop table [tablename]              //delete the table
#desc [tablename]                          //show the table structure
#show tables                                     //list all tables;

Data backup and restore

  #mysqldump -u [userid] -p  [database] [table]> [file]
   #mysql  -u [userid] [database] < [file]
      






         
               

No comments:

Post a Comment