Essential MySQL Commands: Cheat Sheet

btd
2 min readNov 12, 2023

Below is a MySQL cheat sheet that covers some of the most commonly used commands and queries in MySQL:

MySQL Basics:

1. Connect to MySQL:

mysql -u username -p

2. Create a Database:

CREATE DATABASE database_name;

3. Select a Database:

USE database_name;

4. Show Databases:

SHOW DATABASES;

5. Delete a Database:

DROP DATABASE database_name;

Table Operations:

6. Create a Table:

CREATE TABLE table_name (
column1 datatype,
column2 datatype,
...
);

7. Show Tables:

SHOW TABLES;

8. Describe Table:

DESCRIBE table_name;

9. Insert Data into Table:

INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);

10. Select Data from Table:

SELECT * FROM table_name;

--

--

btd
btd

No responses yet