Skip to main content

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;


Comments

Popular posts from this blog

creating first go program

for creating go program open your editor and paste this code, and save it as filename.go for example helloworld.go

package main import "fmt" func main() { fmt.Println("Hello, 世界") }
I will explain these codes in details for now , we will look how to run these code.

to run type go run helloworld.go  in terminal , we get


you can try golang online as well , golang