MySQL: Add a new user
by admin on Jan.17, 2011, under Random()
In order to increase the security of my website I decided to use seperate MySQL accounts for each service provided by my it. It is much more comfortable to use one account, but using seperate accounts offers several advantages:
- If the password gets stolen, the thief only gets access to one database instead of all
- Websites for different customers can be hosted on the same machine and everyone gets his/her own password for their private space
- Different permissions can be assigned to each user
Sounds nice, doesn’t it?
In order to manage my MySQL user accounts I use phpMyAdmin. After logging in with my root account I click the SQL button:
The MySQL query window pops up. Enter the following command:
GRANT ALL ON ajaxChat.* TO 'ajaxChat'@'localhost' IDENTIFIED BY 'password'
This will grant read/write permissions for a newly created user “ajaxChat” on the newly created database “ajaxChat“.
VoilĂ !