AMZ DIGICOM

Digital Communication

AMZ DIGICOM

Digital Communication

MariaDB change user password: change your password

PARTAGEZ

SET PASSWORD is a MariaDB command that allows you to change the password of an existing user. You need to change passwords in different situations in order to secure your database.

When should you change a MariaDB user's password?

Changing a user's password in MariaDB is an important part of any database environment's security strategy. This must be done whenever there is a concrete reason or the security policy requires it. As soon as a user leaves the company or changes roleyou should immediately update or disable all its associated passcodes. Likewise, any suspicious behavior, such as unusual login attempts or access to sensitive data, requires an immediate password change.

Passwords should also be changed in the event of a public leak, whether due to misconfiguration, a poorly sent script, or entry into a version control system. In such cases, a quick password change protects against unauthorized access. Additionally, many safety standards recommend change passwords regularlyfor example every 90 days. In critical environments, this is even more important.

Bottom line: change passwords whenever there is a risk and don't wait until something goes wrong.

Computer Engine

The ideal IaaS solution to manage your workloads

  • Cost-effective vCPU and high-performance dedicated cores
  • No commitment for more flexibility
  • 24/7 expert support included

SET PASSWORD in MariaDB

The order SET PASSWORD Allows you to change user passwords in MariaDB. If you do not specify clause FORthe change will affect the currently logged in user. As soon as you use FOR ‘user ‘@’host’you are targeting a specific account. In this case you need the right UPDATE on the database mysqlbecause this is where MariaDB manages user information.

The general syntax is as follows:

SET PASSWORD FOR 'user'@'host' = PASSWORD('newpassword');

sql

In current versions of MariaDB (from 10.4), use ALTER USER to specify the password directly in plain text:

ALTER USER 'user'@'host' IDENTIFIED BY 'newpassword';

sql

The reason for switching to the new variant: the old function generates an internal hash and is only compatible with certain password-based authentication plugins, such as mysql_native_password, ed25519 Or mysql_old_password. Other plugins like unix_socket, pam, gssapi Or named_pipe do not store passwords in the database; in these cases, the use of SET PASSWORD results in an error.

You can change a user's password directly through the MariaDB client. The connection is made via SSH.

First open an SSH session and connect to the server. To start the client MariaDB with administrator rights, enter the following command:

After entering your SSH user password, you will have access to the MariaDB interface. There, the database environment welcomes you. A command prompt appears:

To manage passwords, you must select the database that contains the user information. By default, this is the database mysql for MariaDB. Then use:

You can now change the password of the desired user. To do this, enter the following instruction:

SET PASSWORD FOR 'newuser'@'host' = PASSWORD('newsecurepassword');

sql

Replace newuser by real username and newsecurepassword with the new password.

If the change is successful, MariaDB confirms the adjustment by displaying a message.

Once the changes are complete, exit the MariaDB client by entering:

This returns you to the normal server console.

If you manage users who log in with a password, SET PASSWORD remains a useful tool. It allows you to quickly respond to security incidents, apply new passwords or ensure secure access after a role change.

Managed databases

Managed and secure databases

  • Flexible solutions, tailored to your needs
  • Professional-grade architecture, managed by experts
  • Hosted in Europe, in accordance with the strictest data protection standards

Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Web Marketing

Localhost: how to connect to 127.0.0.1?

When you call an IP address, you are usually trying to contact another computer on the Internet. However, if you call the IP address 127.0.0.1,

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact