My Profile Photo


I'm Jason, a web applications developer in the San Francisco Bay area.


Back to Cheat Sheets

Command Line Commands

# Log into MySQL server as root with password
$ mysql -u root -p

MySQL Client Commands

# quit client

# show list of databases
show databases;

# use database
use redconfetti;

# show tables in current database
show tables;

# create user account accessible from localhost
CREATE USER 'user'@'localhost' IDENTIFIED BY 'secretpass';

# create user account accessible from any host
CREATE USER 'user'@'%' IDENTIFIED BY 'secretpass';

# grant all privileges on database to user
GRANT ALL PRIVILEGES ON my_database.* TO 'user'@'%';