Useful and important commands for mySQL & MariaDB

Create database:

CREATE DATABASE database1;

Create user

CREATE USER user IDENTIFIED BY 'secure_password';

Grant all privileges on specific database:

GRANT ALL PRIVILEGES ON database1.* TO user;

Show all users:

SELECT User FROM mysql.user;

Show all databases:

SHOW DATABASES;

Delete user:

DROP User 'user'@'localhost';

Remove database:

DROP DATABASE YourDatabase;

Reload the GRANT tables to enable the changes to take effect without reloading or restarting mysql service:

FLUSH PRIVILEGES;
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x