Monday, April 23, 2012

mysql commands

Set mysql root password
mysqladmin -u root password 'new-password'


Show databases
mysql> show databases;
mysql> use databasename;


Show tables
mysql> show tables;


Show columns
mysql> select column from tables;


Backup database
$mysqldump -u  -p  > backupdatabase.sql


Restore database
mysql -u  -p  < databasebackup.sql

No comments: