Create MySQL/MariaDB user

User account can be created by using MySQL's GRANT statement. For this, you'll need to login to MySQL using the root account, which has full privilege on the mysql.user table.

The following statement will create a user account named myusername which will have full access to the mydatabase database from localhost and set the password to mypassword

 GRANT ALL ON mydatabase.* TO 'myusername'@'localhost' IDENTIFIED BY 'mypassword';

Sign up for The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert and many other great courses on Udemy to learn more.

The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert

Become an In-demand SQL Master by creating complex databases and building reports through real-world projects!

Written by Mohd Shakir Zakaria.

Last updated on 2019-02-12.