MySQL
Jump to navigation
Jump to search
Login
$ mariadb -u USERNAME -p
Create user
CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'wikipassword';
Permissions
GRANT ALL ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
Check permissions
SHOW GRANTS FOR 'user'@'localhost';
Create database
CREATE DATABASE database_name;
Delete database
DROP DATABASE database_name;
Inspect database
use DATABASE
show tables;
desc TABLE;
(displays the properties of the table)
show keys from TABLE;
dump sql file
$ mariadb -u username -p database_name > file.sql
import sql file
$ mariadb -u username -p database_name < file.sql
Stop and start the MySQL service
$ sudo systemctl stop mariadb $ sudo systemctl start mariadb $ sudo systemctl restart mariadb