MySQL Cheat Sheet

Login (terminal):mysql -u[username/root] -p[password] -h[host/localhost]Show Databases:SHOW DATABASES;Create Database:CREATE [database_name]Select Database:USE [database_name];Delete Database:DROP [database_name];Create Table: CREATE TABLE [table_name](id INT AUTO_INCREMENT,first_name VARCHAR(100),last_name VARCHAR(100),email VARCHAR(50),password VARCHAR(20),location VARCHAR(100),dept VARCHAR(100),is_admin TINYINT(1),register_date DATETIME,PRIMARY KEY(id)); Show Tables:SHOW TABLES; Delete Table:DROP TABLE [table_name]; Insert Record (One row):INSERT INTO users (first_name, last_name, email, password, location, dept, is_admin, register_date) values (‘Brad’, ‘Traversy’, ‘[email protected]’, ‘123456’,’Massachusetts’, ‘development’, …

MySQL Cheat Sheet Read More »