Answered by the Webhosting Experts

Hivelocity
Dedicated Servers

Bare Metal Computing
Tired of overpaying for outdated hardware or nonexistent technical support?

Click now and chat with our highly skilled account managers. Learn about Hivelocity's latest server deals or browse our bare metal servers by clicking the link below.

See the Hivelocity difference today!

Tags
...
...

How to Reset MySQL root Password

If you’ve forgotten or need to change your root user password in MySQL, you might be wondering what steps are necessary to reset your MySQL root password. Luckily, there are couple of ways to do this.

 

Using the mysqladmin Command to Change root Password

If you’ve never set a root password for MySQL, the server does not require a password when connecting as root. If this is your first time setting up the root password, you can do so using the mysqladmin command from within the shell prompt using:

$ mysqladmin -u root password NEWPASSWORD

In the above instance, you would need to change “NEWPASSWORD” to whatever you would like your new password to be.

If, however, this is not your first time setting the password and you’d like to change or update the existing root password, then you would need to enter this command:

$ mysqladmin -u root -p'OLDPASSWORD' password NEWPASSWORD

For example, if your old password is “abc” and you wanted to set your new password to “123456”, you would tweak the command so that it looks like this:

$ mysqladmin -u root -p'abc' password '123456'

 

Changing MySQL Password (Non-Root Users)

Beyond changing the root password, you can use the mysqladmin command to change the password for non-root users as well. By replacing the “root” in the command above with the name of the user whose password you are attempting to change, you can change the password of any specific database user.

For example, if you wanted to change the password for a user named “vivek” you could do so by entering the follow command:

$ mysqladmin -u vivek -p'OLDPASSWORD' password NEWPASSWORD

Just like in the examples above, you would still need to enter the user’s old password in the space marked “OLDPASSWORD” and replace the “NEWPASSWORD” at the end of the line with whatever you desire the new password to be.

 

Manually Changing the root Password

As mentioned earlier, using the mysqladmin command isn’t the only way to change the root password in MySQL. For those of you who prefer a more hands on approach, you can also change the root password from within the terminal by utilizing the following series of commands.

  1. First, you’ll need to stop MySQL. As the root user enter the command:
    [email protected] [~] /etc/init.d/mysqld stop

  2. Next, you’ll need to start MySQL server without a password. Use this command to do so:
    [email protected] [~] mysqld_safe –skip-grant-tables &
    Make sure you include the “&” at the end of this, as this will allow the command to run in the background

  3. Now login to MySQL using the “mysql” command:
    [email protected] [~] mysql

  4. Once you have access to the mysql prompt then run the following commands:
    mysql >use mysql
    mysql >UPDATE user SET Password=PASSWORD(‘NEWPASSWORD’)
    you will need to replace “user” with “root” if you are attempting to change the root password.

  5. From there, exit out of MySQL using:
    mysql >quit

  6. To finalize your changes, you’ll need to stop MySQL Server and start it back up again using:
    [email protected] [~]/etc/init.d/mysqld stop
    [email protected] [~]/etc/init.d/mysqld start

Now you can access your mysql service by using:

[email protected] [~]#mysql -u root -p

Like the mysqladmin method above, this method can be used to change other users’ passwords as well by replacing the “user” in the “UPDATE user SET Password=PASSWORD(‘NEWPASSWORD’)” command with the name of the user whose password you are trying to change.

And there you have it! Now you know how to set, change, and reset the root password within MySQL.

 

Popular Links

Looking for more information on MySQL? Search our Knowledge Base!

Interested in more articles about Databases? Navigate to our Categories page using the bar on the left or check out these popular articles:

Popular tags within this category include: MySQL, MSSQL, phpMyAdmin, PostgreSQL, and more. 

Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.

 

The Hivelocity Difference

Seeking a better Dedicated Server solution? In the market for Private Cloud or Colocation services? Check out Hivelocity’s extensive list of products for great deals and offers.

With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.

Unsure which of our services is best for your particular needs? Call or live chat with one of our sales agents today and see the difference Hivelocity can make for you.

Share

Facebook
Twitter
LinkedIn
Email
WhatsApp

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: [email protected] We are also available to you through our phone and live chat system 24/7/365.

Rapid Restore

Backup your entire server’s data every night and have access to 5 days of rolling restore points.  Restore your server’s data, OS and configuration any time you need it.

Our Rapid Restore service saves the day during accidental data loss, hardware failures and virus contraction. Simply pick your recovery point and restore the data from that day. 

DDoS Protection

While our competitors may advertise DDoS protection, most often, they are merely implementing easily evaded router rules or simply black-holing targeted servers. They consider this “DDoS protecting their network.” However, neither of these solutions should give comfort to any online business. Should your site be attacked, chances are likely both of these options will end with your server being taken offline. At Hivelocity, we take the responsibility of keeping your servers online very seriously. For this reason, we offer two very serious forms of DDoS protection.

FREE

Every solution we provide includes our Filtering Edge of Network System (FENS). FENS is a series of proprietary systems that proactively monitors and protects the entire Hivelocity Network from most common Denial of Service (DOS) and Distributed Denial of Service (DDoS) attacks.

$15/MONTH PER SERVER

For an extra fee, you can enhance your server’s protection further with the addition of our Server Defense System. Our Server Defense System sits in front of your server, inspecting inbound data and looking for malicious traffic. The moment an attack is detected, it instantly begins scrubbing each data packet. Hivelocity’s Server Defense System delivers business continuity even in the face of massive and complex attacks.

Our Server Defense System is like adding an alarm and armed guard to your business, alerting you to and destroying anything attempting to jump that fence. Our Server Defense System utilizes internally developed proprietary systems in addition to Corero’s Threat Defense Smartwalls for data packet scrubbing. Each of our data centers is a scrubbing center with Corero Smartwalls on-premise, allowing us to provide on-prem zero-lag data scrubbing.

SSL Certificates

The security of your online commerce and protecting your customers’ data is as important to us as it is to you. When your customers see the green bar, they will know their connection to you is protected. We offer single domain, multi-domain, and wild-card certificates.

We offer industry leading 128-bit encryption certificates, allowing you to conduct e-commerce with complete security. Inspire confidence in your customers by displaying any number of seals and indicators certifying that your site is secure.

Load Balancing

Adding this service to two servers with identical content will allow you to distribute your load evenly across your hardware. Don’t lose business because you couldn’t handle the demand. Load balance and handle your biggest resource spikes with ease.

Firewalls

Stop attacks, prevent unauthorized access, and achieve regulatory compliance. Our Juniper hardware firewalls offload the work so your server never has to consume resources protecting itself from malicious traffic. A single firewall can be used to protect multiple servers.

Cloud Storage

Cloud storage offers users redundancy and easy accessibility, ensuring your data remains secure and readily available. Scale to as much as you need for only a 20¢/GB.

Cloud Storage is distributed and replicated across many servers, protecting your data from hardware failure. Highly scalable, it can handle thousands of client connections via TCP/IP. Connect to your virtual drive with SFTP, FTP, and SSHMount and in the future NFS and AFP. Cloud Storage is based on a stackable design which is upgradeable up to 2TB per instance.