Installing a new database server
Packages
apt-get install mysql-server phpmyadmin
From Debian 9 this will install MariaDB
Initial setup
run
mysql_secure_installation
to set up a root password and delete the test database
notes on root
Nowadays when you are logged in to bash as root, you can enter mariadb by just running mariadb / mysql and will not be prompted for a password! However, you can also not enter mysql as root from another user or from phpmyadmin! [1]
So to fix this, we enter mysql and do:
update mysql.user set plugin = 'mysql_native_password' where User='root'; flush privileges;
Create a new database
create user user@localhost identified by 'somepass'; create database dbname; grant all on dbname.* to user@localhost; flush privileges;