Editing MySQL users—whether you’re changing passwords, renaming accounts, or modifying privileges—is a common task for database administrators. Here’s a complete tutorial with step-by-step instructions and video guides to help you master it.
🛠️ How to Edit MySQL Users
✏️ 1. Change a User’s Password
Use the ALTER USER
command:
ALTER USER 'username'@'host' IDENTIFIED BY 'new_password';
📺 21 | Change Username & Password in MySQL Database shows how to update credentials directly in SQL or via a PHP interface.
📺 How to reset or Change Password for User in MySQL Server demonstrates using ALTER USER
to reset passwords securely.
🔄 2. Rename a User
RENAME USER 'old_user'@'host' TO 'new_user'@'host';
📺 How to Create/Rename/Alter/Drop new user in MySQL 8 walks through renaming users and altering their properties in MySQL 8.
🔐 3. Grant or Revoke Privileges
GRANT SELECT, INSERT ON database_name.* TO 'username'@'host';
REVOKE INSERT ON database_name.* FROM 'username'@'host';
📺 Creating and granting permission to MySQL users explains how to assign roles and permissions to users.
📺 Grant & Revoke MySQL User Privileges Tutorial provides a beginner-friendly walkthrough of privilege management.
🧹 4. Delete a User
DROP USER 'username'@'host';
📺 MySQL – Create, Delete User Accounts and Grant Privileges covers user creation, deletion, and privilege assignment in depth.
📺 Understanding MySQL Users explains how MySQL stores user accounts and how to manage them effectively.
🖥️ 5. Edit Users via phpMyAdmin
If you prefer a graphical interface:
- Go to the User Accounts tab.
- Select a user and click Edit Privileges.
- Change password, permissions, or delete the user.
📺 phpMyAdmin User privileges (MySQL tutorial for MySQL) shows how to manage users visually, including creating, editing, and deleting accounts.
📚 Helpful Resources
- MySQL ALTER USER Statement – Tutorialspoint – Covers all options for modifying user accounts.
- Create and Edit Users in MySQL – Rackspace Docs – Step-by-step guide for user management.
- MySQL 8.4 Reference Manual: ALTER USER – Official documentation with advanced options.