MySQL Cheatsheet

  1. Enter the database
mysql -u root -p
  1. List all databases
SHOW DATABASES;
  1. Switch to a database
USE [DB_NAME];
  1. List all tables in the current database
SHOW TABLES;
  1. List all data in a table
SELECT * FROM [TABLE_NAME];
  1. Get root random password generated by mysql docker
docker logs my-mysql 2>&1 | grep GENERATED

Be sure to log in as the root user afterwards