Create a new user in MariaDB database 2019
If you haven't installed MariaDB, please go back to Part 1 using the drop down menu above.
The next thing we need to do is create a new user. You can create as many users as you like, with each user being able to login to MariaDB and create new database(s).
If you have ever used CPanel to create a new database with a new user, this is the very same thing but using the terminal.
To create a new user in MariaDB, first we need to login to MariaDB as root.
mysql -u root -p
Now we need to create a new user. In the terminal enter the following command.
CREATE USER 'mycomputertips'@'localhost' IDENTIFIED BY '12345';
We have just created a new user named mycomputertips
with password 12345
. You wouldn't use 12345
in real life, but for learning purposes we keep it simple.
If you want user mycomputertips
to be able to CREATE, UPDATE, DELETE and perform other database operations, we need to grant mycomputertips
In the terminal enter the following command
GRANT ALL PRIVILEGES ON * . * TO mycomputertips@localhost;
has now been granted all privileges.
To login as user mycomputertips
and create your first database enter the following command to exit MariaDB
Then login as user mycomputertips
and when prompted enter your password 12345
mysql -u mycomputertips -p