How to create a database, user with password in MySQL/MariaDB


Here is the step for creating a MySQL/MariaDB database with a user and password.

Step1:
Login to MySQL/MariaDB shell

sudo mysql -uroot -p

(provide root password)

create database dbname;
CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'dbuserpassword';
GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit;


0 Komentar