My Computer Tips

Home | About | Categories | All Tips & Tutorials

Create a new user in MariaDB and GRANT ALL privileges

ID: 96

Category: MariaDB Database

Added: 28th of May 2018

Views: 3,017

ⓘ This article is now out of date

Please note:
The information below is now out of date. For a more up to date tutorial, please visit https://www.mycomputertips.co.uk/118, which covers creating a new user and granting privileges.

Part 1: Install MariaDB in Ubuntu
Part 2: Create a new user

If you have been following our MariaDB tutorials in Part 1 we installed MariaDB and logged in as root.

In Part 2 we create a new user and assign that new user all privileges, enabling the user to create, insert, update, delete and query databases

In the terminal enter the following command.
The command creates a new user name mycomputertips@localhost with the password 12345
CREATE USER mycomputertips@localhost IDENTIFIED BY '12345';

Now we want to give the user mycomputer@localhost all the privileges
In the terminal enter the following command
GRANT ALL PRIVILEGES ON * . * TO mycomputertips@localhost;

Now we need to exit MariaDB. Enter exit in the terminal
exit

Then login as the new user remembering to enter your password
mysql -u mycomputertips -p

If everything went as planned you should have logged in as mycomputertips and be at the MariaDB prompt.