Skip to content

Instantly share code, notes, and snippets.

@dariubs
Last active January 4, 2020 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dariubs/f7975ed19cc381468245d49f9cf6db9a to your computer and use it in GitHub Desktop.
Save dariubs/f7975ed19cc381468245d49f9cf6db9a to your computer and use it in GitHub Desktop.
MySQL

create user

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

grant privilages to user

GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
FLUSH PRIVILEGES;

delete user

DROP USER 'username'@'localhost';

user grants

SHOW GRANTS FOR 'user'@'localhost';

create db

CREATE DATABASE dbname;

show dbs

SHOW DATABASES;

use specific db

USE dbname

show selected db tables

SHOW TABLES;

create table

CREATE TABLE tablename(
  c1 type meta,
  c2 type meta,
  ...
);

delete a table

DROP TABLE tablename;

delete a database

DROP DATABASE dbname;

exit from mysql

exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment