Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rothkj1022/ecd8aeb62e7fad1f2b5fb550d251fdfc to your computer and use it in GitHub Desktop.
Save rothkj1022/ecd8aeb62e7fad1f2b5fb550d251fdfc to your computer and use it in GitHub Desktop.
Process for changing MySQL root password on CentOS Web Panel from command line

Process for changing MySQL root password on CentOS Web Panel from command line

Run CWP's script to reset password

$ sudo sh /usr/local/cwpsrv/htdocs/resources/scripts/mysql_pwd_reset

** Make note of the new password provided by the script

Log in as root with old password

$ sudo mysql -u root -p

Run the following queries, replacing with new password provided by the script

> GRANT ALL PRIVILEGES on *.* to 'root'@'localhost' IDENTIFIED BY '<password>';
> FLUSH PRIVILEGES;
> exit

Test that the new password works:

$ sudo mysql -u root -p
> exit

Restart CWP for good measure

$ systemctl restart cwpsrv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment