Note: This tutorials assumes you are using Linux and that you have already installed MySQL / MariaDB server.
For tutorial purposes I use simple passwords in my examples, it goes without saying you would not assign these sorts of passwords for real database applications.
MySQL / MariaDB Basic Security
When you set up MySQL / MariaDB database you should always set a strong password for the root user.
Secondly it is advisable to create a new user, with a strong password after this, and then assign the new user with database privileges.
Any database your create after this point should be done under your new user and not under the root account.