1. Install mysql in ubuntu using below command:
sudo apt-get install mysql-server mysql-client
2. Connect to mysql using below command:
quit;
9. Test the above steps are working or not using below command:
mysql -u username -p -h hostname
provide the 'password'
mysql -u root -p
provide mysql password given as part of installation step1
3. Create a new user in mysql with password
CREATE USER 'username'@'hostname' IDENTIFIED BY 'password';
4. Revoke all privileges to new user
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'username'@'hostname';
5. Grant required privileges to new user to specific database
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES,EXECUTE ON databasename.* TO 'username'@'hostname';
provide mysql password given as part of installation step1
3. Create a new user in mysql with password
CREATE USER 'username'@'hostname' IDENTIFIED BY 'password';
4. Revoke all privileges to new user
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'username'@'hostname';
5. Grant required privileges to new user to specific database
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES,EXECUTE ON databasename.* TO 'username'@'hostname';
6. Grant required privileges to new user to all databases
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES,EXECUTE ON *.* TO 'username'@'hostname';
7. Commit the changes
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES,EXECUTE ON *.* TO 'username'@'hostname';
7. Commit the changes
FLUSH PRIVILEGES;
8. Exit from mysql
8. Exit from mysql
quit;
9. Test the above steps are working or not using below command:
mysql -u username -p -h hostname
provide the 'password'
10. After verification , exit from mysql
quit;
quit;