MariaDB / MySQL Administration
When using MariaDB, one can use the
mariadb command interchangably with the
mysql command. The latter is used to better fit into existing scripts and infrastructure.
sudo apt install mariadb-server
Depending on the version and installation settings, logging in to the freshly installed database server can be done with either of the following
mysql [-h hostname] -u root -p sudo mysql # if the above does not work
create database $DB_NAME; show databases; use $DB_NAME; -- start working with this database drop database $DB_NAME;
create user '$USER'@'localhost' identified by '$PASSWORD'; grant all privileges on $DB_NAME.* to '$USER'@'localhost';
After logging in and selecting a database, one can create, change and remove database relations (tables).
create table $TABLE_NAME ( -- column definitions ); show tables; describe table $TABLE_NAME; show create table $TABLE_NAME; alter table $TABLE_NAME ...; drop table $TABLE_NAME;
More information on
A comprehensive example can be found on Wikiversity.