Get 69% Off on Cloud Hosting : Claim Your Offer Now!
Managing users and permissions in MySQL ensures secure and efficient database operations. Here’s a step-by-step guide.
Log in to MySQL as root:
shell
mysql -u root -p
Create a new user:
sql
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
username: The new user's name.
host: Specifies access location (e.g., % for all hosts, localhost for local access).
Grant specific permissions:
sql
GRANT SELECT, INSERT ON database_name.* TO 'username'@'host';
Grant all privileges:
sql
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'host';
Apply changes:
sql
FLUSH PRIVILEGES;
View user privileges:
sql
SHOW GRANTS FOR 'username'@'host';
Revoke privileges:
sql
REVOKE privilege_type ON database_name.* FROM 'username'@'host';
Proper user management is critical for database security. For hosting your databases securely, consider Cyfuture Cloud, which offers scalable and reliable database hosting.
Let’s talk about the future, and make it happen!
By continuing to use and navigate this website, you are agreeing to the use of cookies.
Find out more