MySQL/MariaDB Command Line Cheatsheet

Connect to Database

mysql [-h 192.168.1.100] -u USER_NAME -p [DATABASE_NAME]

You’ll be prompted for the password. All commands inside the MySQL shell must end with ;.

Common Commands

SHOW TABLES;
SHOW DATABASES;
USE database_name;
DESCRIBE table_name;
SELECT * FROM table_name;

Exit

Press Ctrl+C or type exit;