HowTo: Change a User’s Password in MySQL

Changing a MySQL user’s password is a task handled by the database administrator (root).

Once the MySQL user’s password is changed, you should update the user’s privileges.

Step 1: Log into MySQL server as root

$ mysql -u root -p

Step 2: Use ‘mysql’ database

mysql> use mysql;

Step 3: Change password for user John

mysql> update user set password=PASSWORD('NEW-PASSWORD-HERE') where User='John';

Step 4: Reload privileges

mysql> flush privileges;
Recommended Book
ansible

With High Performance MySQL, you’ll learn advanced techniques for everything from designing schemas, indexes, and queries to tuning your MySQL server, operating system, and hardware to their fullest potential.

This guide also teaches you safe and practical ways to scale applications through replication, load balancing, high availability, and failover.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.