Reset The root MYSQL/ MariaDB Password

Reset The root MYSQL/ MariaDB Password

Category : How-to

Get Social!

mysql-logoIf you’ve lost or forgotten the root user password on a MySQL or MariaDB server you’ll want to reset it and leave all the other accounts and data intact. Fortunately it’s possible, but you’ll need access to an SSH account hosting the instance and the ability to stop and start the database service.

Before going any further, make sure your instance of MySQL or MariaDB is shutdown.

service mysql stop

Start the server in safe mode and don’t load the table grants and permissions.

mysqld_safe --skip-grant-tables &

Log into the local instance with the root user.

mysql -u root mysql

Run the below commands SQL, once connected, and reset your password. Be sure to substitute new-password with the new password for your root account.

use mysql;
UPDATE mysql.user SET Password=PASSWORD('new-password') WHERE User='root';
FLUSH PRIVILEGES;
exit;

Finally, start the SQL server instance and use your new root account password.

service mysql restart
mysql -u root -p

 


Change the Password for an OpenVZ Container

Category : How-to

Get Social!

openvz-logo-150px_new_3If you have forgotten the password for an OpenVZ container – relax! Help is at hand.

Luckily OpenVZ makes it very easy to set or reset the password for any user of a container. You’ll need access to the terminal on the hardware node which is running the container to run a simple vzctl command.

vzctl is the CLI command which is used to configure and control an OpenVZ container. Using the –userpassword switch we can reset a users password. We can also use this command to create a new user if the specified user does not already exist.

vzctl set [VMID] --userpasswd [USER]:[PASSWORD]

Run the above command and substitute the following values for your own:

  • [VMID] is the ID of the container to set the new password on.
  • [USER] is the name of the user that you’d like to change the password for. If this user doesn’t exist then a new user will be created.
  • [PASSWORD] is the password to set for the [USER].

Note: The container needs to be running for this command to work as the user information is saved within the container and not in the containers configuration file like many of the other vzctl commands. If the container is not already running, this command will start it.

 


How to change a linux login password

Category : How-to

Get Social!

It’s easy to change your password in linux – don’t bother with the GUI’s which ship with distros such as Ubuntu, just hit the command line!

To change a linux users password, just type passwd and enter your new password:

# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

If you are not logged in as that user, you can run the command with sudo and the users name:

# sudo passwd james
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

 


Visit our advertisers

Quick Poll

Do you use ZFS on Linux?

Visit our advertisers