Pages

8/13/2014

02.mysql database:create,show,rename,delete

For creating database use the command
CREATE DATABASE IF NOT EXIST db_name;

For showing existing databases use the command
SHOW DATABASES;

For rename database name is little bit a task,Actually you cannot rename a database.What we have to is back up our database then delete the database and create a new database import the backup database to the new database.

1.mysqldump -u username -p -v olddatabase > olddbdump.sql
2.mysqladmin -u username -p create newdatabase
3.mysql -u username -p newdatabase < olddbdump.sql

1.First create a backup,2.then create a new database,3.then import the backupdump.

In older Mysql version 5.1,There is a command RENAME db_name TO db_name;

but this has removed from 5.5 versions.

For delete a database use the command
DROP DATABASE db_name;


No comments:

Post a Comment

widget

selenium javascript alert box

This is a easy task to capture javascript based alertbox , /* * To change this license header, choose License Headers in Project Properti...