MySQL / cmd - most useful commands

0 points
Created by:

In this article, we would like to show you the most useful cmd commands for MySQL.

1. Login user

Quick solution:

mysql -u root -p

Full command: 

mysql --user=<username> --password=<password>


If you didn't specify password during mysql installation use the following command:

mysql --user=root --password=

2. Show databases

Quick solution:

SHOW databases;

3. Create / Drop database

Quick solution:

CREATE DATABASE database_name;
DROP DATABASE database_name;

4. Use / switch database

Quick solution:

USE database_name;


To switch database simply use the above command with a different database_name.

5. Show tables

Quick solution:

SHOW tables;

6. Create / Drop table 

Quick solution:

CREATE TABLE table_name;
DROP TABLE table_name;

MySQL / cmd

Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂