cheats/sql.md

21 lines
413 B
Markdown
Raw Permalink Normal View History

2020-02-13 18:19:29 +01:00
# SQL Cheats
## Create database users
`CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';`
2020-03-24 17:21:52 +01:00
List current users:
> `select host, user from mysql.user;`
2020-02-13 18:19:29 +01:00
## 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;`