Nvidia Unveils Futuristic Gaming Experience at Computex 2023
News

Nvidia Unveils Futuristic Gaming Experience at Computex 2023, Blending Gaming and AI

by Isabel
May 29, 2023
0

At Computex 2023, Nvidia displays a futuristic gaming experience that...

Read more
Adobe Introduces Powerful Generative AI Tools in Photoshop

Adobe Introduces Powerful Generative AI Tools in Photoshop Beta

May 29, 2023
Adobe Photoshop's Generative Fill Feature

Exploring the Power of Adobe Photoshop’s Generative Fill Feature

May 27, 2023
NVIDIA and Microsoft Partner to Accelerate AI

NVIDIA and Microsoft Partner to Accelerate AI

May 25, 2023
google photos security and privacy

Exploring the Top 5 Privacy and Security Risks of using Google Photos

May 24, 2023
Bard API key

Everything You Need to Know About Google’s Bard API Key

May 20, 2023
Open AI ChatGPT Plugins

ChatGPT Plugins: Complete Guide

April 27, 2023
how to use Bard AI

How to Effectively Use Google BARD: A Beginner’s Guide

May 12, 2023
Leonardo AI Login

How to login and use Leonardo AI to generate high-quality image

May 30, 2023
How-to-install-MLC-LLM

How to install MLC LLM

May 2, 2023
AutoGPT plugins

Simplify Your Email Life with AutoGPT Plugins

May 5, 2023
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home MySQL

How to Change MySQL Root Password Simple Trick

by Cloudbooklet
March 3, 2022
in MySQL
Reading Time: 5 mins read
How to Reset Change MySQL Root Password
Share on FacebookShare on TwitterShare on WhatsAppShare on Telegram

How to change MySQL Root Password on Ubuntu or Debian or CentOS. Ever forgotten your MySQL root password or fixing a MySQL installation on a new server, we have all been there.

In this guide you are going to learn how to change MySQL root password or Reset it in case you forget it for MySQL 8, MySQL 5.7 and MySQL 5.6.

You might also like

Install WordPress with Docker Compose, Nginx, Apache with SSL

WordPress Deployment Made Easy: Docker Compose, Nginx, Apache, SSL Setup Guide

May 20, 2023
Install phpMyAdmin on Ubuntu 22.04 with Apache

Install phpMyAdmin on Ubuntu 22.04 with Apache

May 19, 2023

This guide is tested on MySQL versions running on virtual machine created on Google cloud with Ubuntu.

Prerequisites

Root access to server or a user with sudo privileges.

Check MySQL version

SSH into your server to check the version of MySQL server installed. Each version has their own method of resetting passwords.

To check the MySQL version use the following command.

mysql -V 

If you are on MySQL 8.0 you will get an out put similar to this.

mysql Ver 8.0.20-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

If you are on MySQL 5.* you will get an out put similar to this.

mysql  Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using  EditLine wrapper

Start MySQL server with skip-grant-table

Now you can stop your MySQL server using the following command.

sudo systemctl stop mysql

Now start MySQL server with the --skip-grant-tables option. The & at the last is required here in the command below.

sudo mysqld_safe --skip-grant-tables&

You should see something similar to the one below.

[email protected]:~$ 2021-02-02T04:45:12.861506Z mysqld_safe Logging to syslog.
2021-02-02T04:45:12.868517Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2021-02-02T04:45:12.911492Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Hit ENTER to return to your terminal.

Login to MySQL without Password

Now you can login to MySQL without password normally.

sudo mysql -u root mysql

Now you will see the mysql> prompt to execute mysql commands.

Change MySQL Root Password v8.0

Execute the following commands for MySQL 8.0.

UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;

Replace new_password with your own password.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';
FLUSH PRIVILEGES;

Exit MySQL.

exit;

Now you can skip to stop and restart MySQL.

Change MySQL Root Password v5.7

Execute the following commands for MySQL 5.7.

UPDATE user SET authentication_string=PASSWORD('new_password') WHERE user='root';
UPDATE user SET plugin="mysql_native_password" WHERE User='root';
FLUSH PRIVILEGES;

Exit MySQL.

exit;

Change MySQL Root Password v5.6

Execute the following commands for MySQL 5.7.

UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';
UPDATE user SET plugin="mysql_native_password" WHERE User='root';
FLUSH PRIVILEGES;

Exit MySQL.

exit;

Stop and Restart MySQL

Stop all running MySQL process using killall command.

sudo killall -u mysql

If you see any MySQL output with ended message hit ENTER to continue.

Start MySQL.

sudo systemctl start mysql

Login to MySQL using the new password.

sudo mysql -u root -p

Enter the new password you set before when prompted.

That’s it, you are done.

Conclusion

Now you have learned how to reset MySQL password on Linux.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: CentOSDebianUbuntu
Share2Tweet1SendShare
Cloudbooklet

Cloudbooklet

Help us grow and support our blog! Your contribution can make a real difference in providing valuable content to our readers. Join us in our journey by supporting our blog today!
Buy me a Coffee

Related Posts

How to Install MariaDB on Ubuntu 22.04

How to Install MariaDB on Ubuntu 22.04

May 16, 2023
Install nopCommerce on Ubuntu 20.04 MySQL Nginx SSL

Install nopCommerce on Ubuntu 20.04, MySQL, Nginx, SSL

May 23, 2023
How to Install Ruby On Rails on Ubuntu 20.04

How to Install Ruby On Rails on Ubuntu 20.04 with MySQL, Nginx, Passenger, SSL

May 23, 2023
How to Install or Migrate WordPress with EasyEngine Setup

How to Install or Migrate WordPress with EasyEngine Setup

May 23, 2023

Leave a Reply Cancel reply

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

I agree to the Terms & Conditions and Privacy Policy.

  • Trending
  • Comments
  • Latest
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

May 30, 2023
DragGAN AI editing Tool Install and Use DragGAN Photo Editor

DragGAN AI editing Tool Install and Use DragGAN Photo Editor

May 27, 2023
Bard API key

Everything You Need to Know About Google’s Bard API Key

May 20, 2023
Install PHP 8.1 on Ubuntu

How to Install or Upgrade PHP 8.1 on Ubuntu 20.04

May 17, 2023
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

75
Upgrade PHP version to PHP 7.4 on Ubuntu

Upgrade PHP version to PHP 7.4 on Ubuntu

28
Install Odoo 13 on Ubuntu 18.04 with Nginx - Google Cloud

Install Odoo 13 on Ubuntu 18.04 with Nginx – Google Cloud

25
Best Performance WordPress with Google Cloud CDN and Load Balancing

Best Performance WordPress with Google Cloud CDN and Load Balancing

23
How to Setup SSH Keys on Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

May 31, 2023
ChatGPT app

The Easiest Way to Download ChatGPT App Free

May 31, 2023
LLM Connected with APIs

Gorilla: LLM Connected with APIs

May 31, 2023
Soundstorm-Pytorch

Soundstorm-Pytorch: A Powerful Tool for Audio Generation

May 30, 2023

Popular Articles

  • DragGAN The AI-Powered Image Editing Tool

    DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

    1436 shares
    Share 574 Tweet 359
  • DragGAN AI editing Tool Install and Use DragGAN Photo Editor

    332 shares
    Share 133 Tweet 83
  • Auto-Photoshop-Stable Diffusion-Plugin: A New Way to Create AI-Generated Images in Photoshop

    70 shares
    Share 28 Tweet 18
  • InternGPT: A New Way to Interact with ChatGPT

    53 shares
    Share 21 Tweet 13
  • Midjourney vs Adobe Firefly: A Comparison of Two AI Image Generation Tools

    10 shares
    Share 4 Tweet 3
Cloudbooklet

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS

Cloudbooklet © 2023 All rights reserved.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.