In this tutorial, we will show you how to change MySQL user password. The instructions should work with any modern Linux distribution such as Ubuntu 18.04 and CentOS 7.

Prerequisites
Depending on the MySQL or MariaDB server version you are running on your system, you will need to use different commands to change the user password.

You can find your database server version by issuing the following command:

mysql --version
If you have MySQL installed in your system the output will look something like this:

mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
Or output like this for MariaDB:

mysql Ver 15.1 Distrib 10.1.33-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Be sure to make note of which version of MySQL or MariaDB you’re running. If you want to get a list of all MySQL user accounts please check this guide.

#mysql

How to Change MySQL User Password
1.10 GEEK