Languages
[Edit]
EN

MySQL / cmd - most useful commands

0 points
Created by:
Dirask Community
6390

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>

Note:

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;

Note:

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.

❤️💻 🙂

Join