Thursday 2 May 2019

MySQL Cheatsheet

Open MySQL command line

mysql -u root -p

Show all databases

show databases;

Create new database


CREATE DATABASE dl_edeposit;

Show all users


SELECT host, user, password FROM mysql.user;

Create new user


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

Grant privilege to a user on a table


GRANT ALL PRIVILEGES ON dl_edeposit.* TO 'dl_edeposit'@'localhost';

No comments:

Post a Comment