cheats/sql.md

21 lines
413 B
Markdown

# SQL Cheats
## Create database users
`CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';`
List current users:
> `select host, user from mysql.user;`
## Create database
First create database:
`CREATE DATABASE <database>;`
Then grant privileges for the user:
`GRANT ALL PRIVILEGES ON <database>.* TO '<username>'@'localhost';`
## Actiavte changes
To activate the changes:
`FLUSH PRIVILEGES;`