Sql commands

From James's Wiki
Revision as of 17:21, 23 December 2021 by Ractive (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
SHOW DATABASES;
DROP DATABASE <database name>;
CREATE DATABASE <database name>;
CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON <database_name>.* TO 'username'@'localhost';
SHOW GRANTS FOR 'username'@'localhost';
DROP USER 'username'@'localhost';
FLUSH PRIVILEGES;

show users:

use mysql;
SELECT user FROM user;