<< More Tips   |   Added On: 28/11/15   |    Category: MySQL    |    Number of Views: 935

Create a new user, assign all privileges using MySQL / MariaDB using Linux

Note: This tutorials assumes you are using Linux and that you have already installed MySQL / MariaDB server.

For tutorial purposes I use simple passwords in my examples, it goes without saying you would not assign these sorts of passwords for real database applications.

To create a new user in MySQL first login to MySQL / MariaDB Database with your root username and password at the terminal by entering the following command
mysql -u root -p

Next we need to create a new user and assign that new user with a password. In the terminal enter the following command.
(We are creating a new user named linuxuser with password 12345678)
CREATE USER linuxuser@localhost IDENTIFIED BY 12345678;

Next we need to assign linuxuser with ALL PRIVILEGES. This means linuxuser can CREATE, UPDATE and perform many other functions.
GRANT ALL PRIVILEGES ON * . * TO linuxuser@localhost;

The account linuxuser has now been created. Next logout of MySQL / MariaDB by entering the exit command

Now we can login as linuxuser and enter the password we created earlier to access MySQL / MariaDB, by entering the following command.
mysql -u linuxuser -p

In the next article I will create a new database, fields and query the database for linuxuser

Linux Services

Buy Linux CDs, DVDs, USB Flash Drives from OSDisc.com

Buy Linux CDs, DVDs, USB Flash Drives from OSDisc.com

Run Windows software on Linux

Run Windows software on Linux with Crossover Office