Create Database and User in MySQL or MariaDB in shell

I write this because just a note or cheatsheet for me to copy and paste from here to make my life easier. Every time when migrate website from one server to one server, I need to recreate the user and database before insert back to the new host.

# mysql

CREATE DATABASE juzhax_database;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON `juzhax_database` . * TO 'newuser'@'localhost';


Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.