
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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’
- Related Articles
- How can we change MySQL user password by using the SET PASSWORD statement?
- How can we change MySQL user password by using UPDATE statement?
- How can we set up a MySQL User account by using INSERT INTO statement?
- How can we set up a MySQL User account by using SQL GRANT statement?
- How to change the local user account password using PowerShell?
- Can we use ADD and CHANGE with ALTER Statement in MySQL?
- How to change the password in MongoDB for existing user?
- How can we create a MySQL user account by omitting the hostname?
- Can we convert MD5 to SHA256 in a MySQL table with user password column?
- How do I change a MongoDB user's password?
- How can we grant privileges to a MySQL user?
- How can we revoke privileges from a MySQL user?
- In MySQL, how can we display time in other format specified by the user?
- In MySQL, how can we display the date in other format specified by the user?
- How can we use SET statement to assign a SELECT result to a MySQL user variable?

Advertisements