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!

Leave a Reply

Your email address will not be published. Required fields are marked *