DEV Community

Aashutosh Poudel
Aashutosh Poudel

Posted on

Some useful MySQL/MariaDB commands to create and provide access to a database.

Login to MariaDB with:

mysql.exe -u root -p <your-root-password>
Enter fullscreen mode Exit fullscreen mode

If your root account doesn't have a password omit the -p option.

Create database with:

create database database_name;
Enter fullscreen mode Exit fullscreen mode

Grant all access to the user with:

grant all on database_name.* to 'root'@'localhost';
Enter fullscreen mode Exit fullscreen mode

If you are logged in with a different user change root to your username accordingly.

Top comments (0)