You need to use mysql (or mysql.exe on MS-Windows based system) under Linux or Unix like operating system. Open a terminal / ssh session. Type the following command at the shell prompt to login as a root user. The syntax is as follows for Unix like operating system:
$mysql -u root -h localhost -pOR use mysql.exe under MS-Windows host as follows (first change directory where mysql.exe is located [example: "C:\Program Files\mysql\mysql-5.0.77-win32\bin"] ):
mysql.exe -h localhost --user=root -pYou will see mysq> prompt as follows:
mysq>Syntax: Sql command to change a user password
Switch to mysql database (type command at mysql> prompt, do not include string "mysql>"):mysql> use mysql;The syntax is:
SET PASSWORD FOR 'user-name-here'@'hostname-name-here' = PASSWORD('new-password-here');
You can also use the following sql syntax:
UPDATE mysql.user SET Password=PASSWORD('new-password-here') WHERE User='user-name-here' AND Host='host-name-here';