Create user MySQL and limit permission
Today, we have project with our partner and he want access to our database (MySQL) to show more information about project. What should i do ? Of course, i can’t send admin account for him because it is very sensitive and maybe it can harm for our system. Ok, I need a new account for our partner and that account just have some permission read on database of this project.
Step 1 : Connect to database with MySQL command
mysql -u root -p
Step 2 : Create account with name (our partner name is peter) CREATE USER ‘username‘@’host‘ IDENTIFIED BY ‘password‘;
username : specify username for account password : is new password for peter user host : IP server user is used to connect to MySQL server
Example : create account peter/[email protected]
CREATE USER 'peter'@'localhost' IDENTIFIED BY '[email protected]';
Step 3 : Grant privileges for account GRANT privileges PRIVILEGES ON database.* TO ‘username‘@’host‘;
privileges : ALL, SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX
database
Example : Grant all permission on database ‘ikewnit’ for account ‘peter’
GRANT ALL PRIVILEGES ON ikewnit.* TO 'peter'@'localhost';
Step 4 : Flush to update privileges
FLUSH PRIVILEGES;
Step 5 : Try to login (use phpmyamin)
Advertisements