A Simple Command-line MySql guideShort URL
Just a simple guide to using the most common MySql functions with the command line.
To create a new database
create database ‘database2’;
grant all on ‘database2’.* to ‘dbuser’@localhost identified by ‘passord’;
flush privileges;
To make a copy of an existing database
mysqldump -u root -p —opt database1 > database_bkp.sql; mysql -u root -p database2 < database_bkp.sql;
Show databases / List content in databases
show databases;
use ‘database2’;
show tables;
To delete a database
drop database ‘database1’;
There are 0 comments
Commenting is closed for this article.