Login to MySQL without worrying about your password:
$ sudo mariadb -u root
First, create a database:
MariaDB> CREATE DATABASE `db_name`;
Then create a user:
MariaDB> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
Grant usage and privileges:
MariaDB> GRANT USAGE ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
MariaDB> GRANT ALL ON `db_name`.* TO 'username'@'localhost';
MariaDB> FLUSH PRIVILEGES;
That’s it!
