Bobcares

Reset MySQL password on Vultr – 5 simple steps to do it

by | Feb 16, 2019

I forgot my MySQL password. Can you reset the MySQL password of my Vultr instance?

That was a recent support ticket received from one of our server owners as part of our Managed Cloud Services.

It’s common that users forget the MySQL root password. Unfortunately, there is no one click option to reset the MySQL password. We need to reset it from command line.

Today, let’s see how our Support Engineers reset MySQL password on a Vultr instance.

 

Reset MySQL password on Vultr – Where it’s needed?

Firstly, let’s see some common scenarios where users need to reset MySQL password.

1) Modify database driven websites

Database driven websites such as WordPress, Joomla, etc. store all their data in their databases. So, to manage these websites, server owners often need to edit/change multiple databases on their system. They usually modify the databases after login to the MySQL database as root user. This gives the user to modify any website databases on the server.

 

2) Securing database application

Similarly, as a part of securing the web applications, server owners often need to reset the MySQL root account password. For example, resetting a simple password to a complex one to improve security.

 

3) Install new applications

Installing new database management applications like phpMyAdmin require MySQL root password. And, if we don’t remember the password, we need to reset the root password of MySQL from command line.

 

Reset MySQL password on Vultr  – Steps to do it

Now, let’s see how our Dedicated Engineers reset MySQL password on a Vultr Cloud Compute.

a) Check the Database software

Firstly, we check the database software and it’s version installed on the Vultr instance. For example, we use the following command to get the type of database software and it’s version.

mysql -V

 

Ubuntu servers generally support mariaDB database while Debian support MySQL database by default.

 

b)Stop MySQL service

To reset the MySQL password, our Support Experts first stop the MySQL service on the Vultr instance. For instance, we use the below command to stop the MySQL service on a CentOS system.

service mysql stop

 

In addition to that, we check the status of the MySQL service using the below command.

ps aux | grep mysql

 

In this way, we confirm that the Vultr instance doesn’t have any active MySQL running processes.

c) Grant password less access

After that, we enable password less access to the MySQL database using the below command.

mysqld_safe --skip-grant-tables --skip-networking &

 

Here, skip-grant-tables ensure that when MySQL is started, it doesn’t look for the grant-tables which contains the user privileges upon connection and query. In other words, anyone can login from anywhere and do anything on the database. But, this is a big security risk. That’s why our Support Engineers add –skip-networking command to only allow connections from the localhost.

d)Reset MySQL password

Further, our Support Engineers login to MySQL using the below command and reset the MySQL password.

mysql -u root

 

For instance, we reset the MySQL root password using the below steps.

UPDATE user SET password=PASSWORD('YOUR_NEW_PASSWORD') WHERE user='root';
FLUSH PRIVILEGES;

 

Replace YOUR_NEW_PASSWORD with the new password.

 

e) Restart MySQL service

Finally, we restart the MySQL service in order to return it to the normal mode. For example, we restart MySQL service from command line using the below command.

service mysql restart

 

Similarly, we restart MariaDB service using the below command.

service mariadb restart

 

You’re done!! You can now use the new root password to access MySQL.

But, sometimes server owners request password less login for MySQL root user, so that it avoids the burden of giving the MySQL root password all the time.

In such cases, our Dedicated Engineers create a file /root/.my.cnf and set the MySQL username and password in this file.

[client]
user=root
password=xxxxx
...

 

Here, replace xxxxx with the MySQL root password. Most importantly, we give suitable permissions for this file to make it readable and writable only by the root user.

chmod 0600 /root/.my.cnf

[Trouble resetting MySQL root password on your Vultr VPS? Click here and get one of our Server Experts to get it fixed.]

Conclusion

In short, server owners can reset the MySQL root password on their Vultr instance using the above 5 simple steps. Today, we’ve discussed how our Support Engineers reset the MySQL root password on a Vultr instance.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF