How to Create a New User and Grant Permissions in MySQL

by JakeMakes in Circuits > Raspberry Pi

884 Views, 10 Favorites, 0 Comments

How to Create a New User and Grant Permissions in MySQL

mysql.jpg

Log in to your PhpMyAdmin.

Select SQL from top menu:

Screenshot from 2017-03-15 19-28-15.png
Screenshot from 2017-03-15 19-54-38.png

To create a new user select users from top menu:

Screenshot from 2017-03-15 19-57-25.png

From there you can select Add user:

Screenshot from 2017-03-15 20-14-50.png

Add usernames and for host select localhost. Now because I need lower level user with less permissions I will select “Create database with same name …”from Database for user and doesn’t select anything else. Now if you want to give user Global privileges you can select them form bottom Global privileges area. It’s good idea to give users only permissions they need. If you are ready press Go. This will create the user and database named as the user. You can now log in with your new user.

Screenshot from 2017-03-15 20-21-16.png

If you need user with even less permissions the log in with your administrator user. Select Users. Behind every username is option “Edit Privileges”. Click this bad boy.

Screenshot from 2017-03-15 21-00-22.png

Now if you select “Database” option from top menu you can select and see which database user have permissions over. From top screenshot you can see that “newuser” has “all privileges” over newuser database.Now we select “Edit Privileges” and now you can see which action “newuser” can perform on the database “newuser”. And this is quick overview how you canmanage users and user privileges.

For more tutorials check jakemakes.eu