Archive of all articles

A Simple Command-line MySql guideShort URL

Jan 15

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’;
Help support my education.. or just buy me a coffee.

There are 0 comments

Commenting is closed for this article.