To make everything is secure, you should create a separate user account for every single database. This will tighten the security of your database server. In this article, I will share how to create MySQL users and grant permission.
How to Create MySQL Users and Grant Permission
Step 1: New User Create in MySQL
Login to the MySQL server with root user and create an user, let’s call the new user is “technoracle”
To login to MySQL server, use following command.
$ mysql -u root -p[Your_MySQL_Password]
MySQL user creation.
mysql> CREATE USER 'technoracle'@'localhost' IDENTIFIED BY 'password';
Now we will assign user with database with full privileges. Let’s take an example database name ‘newDb’.
mysql> GRANT ALL ON newDb.* TO 'technoracle'@'localhost';
after this step, run following command
mysql> FLUSH PRIVILEGES;
Step 2: Create Remote MySQL users and Grant Permissions.
To connect database server remotely, you can create remote user or can allow any host. You will need remote machine IP to create remote MySQL users.
mysql> CREATE USER 'technoracle'@'IP Address' IDENTIFIED BY 'password'; mysql> CREATE USER 'technoracle'@'%' IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES;
In this article, you have learned how to create MySQL user, and how to give them permission. If you like this article, please share it on social media.