Category:
If you have access to the server's console, you can change the password of the user of your choice via the mysql client in SSH.
If you have access to SSH, enter the following to access the mysql client:
:~$ sudo mysql [sudo] password for youruser:
You will then see - after correctly entering your SSH user's password, the following console:
Welcome to the MariaDB monitor. Commands end with ; or φ. Your MariaDB connection id is 3260 Server version: 10.5.19-MariaDB-0+deb11u2 Debian 11 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Choose the appropriate database where you want to change the user, on mysql/mariadb installations this defaults to "mysql":
MariaDB [(none)]> use mysql; Database changed
Then enter the new password via an SQL statement and hit enter:
MariaDB [mysql]> SET PASSWORD FOR 'mydbusername'@'localhost' = PASSWORD('mynewpassword'); Query OK, 0 rows affected (0.001 sec)
The above query will change the password for mydbusername to mynewpassword.
Please note, this is only for logging into the database on localhost.
If you want mydbusername to be able to log in from any host you must specify '%' instead of 'localhost'.
You can exit the mysql client with exit after the change:
MariaDB [(none)]> exit;
Were not all your questions answered?
Don't worry, we will be happy to help you via a support request!