Apart of the MySQL command line interface a a system administrator is able to change MySQL user's password using mysqladmin command directly from a shell command line. The following linux command will change/update a current MySQL root password given that current password is blank:
# mysqladmin -u root password 'newpass'
The above command will change MySQL root's password to newpass. To change MySQL root's password to abc123 where that current password is set to newpass we need to use -p option which allows us to supply the mysqladmin command with a current user password. For example:
# mysqladmin -u root -pnewpass password 'abc123'
Test the new password:
# mysqladmin -u root -pabc123 ping
mysqld is alive
Please note the deliberate lack of space between -p option and current user password. The above method can be used to change password for any other user.
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: