- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we change MySQL user password by using the ALTER USER statement?
We can also use ALTER USER statement along with IDENTIFIED BY clause to change MySQL user password. Its syntax would be as possible −
Syntax
ALTER USER user_name@host_name IDENTIFIED BY ‘new_password’
Here,
- New_password would be new password we want to set for MySQL user
- User_name is the name of a current user.
- Host_name is the name of the host of a current user.
Example
Suppose if we want to change the password user@localhost to ‘tutorials’ then it can be done as follows −
ALTER USER user@localhost IDENTIFIED BY ‘tutorials’
Advertisements