Sql commands: Difference between revisions
From James's Wiki
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
DROP DATABASE <database name>; | 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; |
Latest revision as of 17:21, 23 December 2021
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;