• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer

GitopsCentral

  • Home
  • Courses
  • Roadmap
  • About
  • Log In
  • Sign Up

How to reset MySQL Password

June 18, 2019 by shaik zillani

If you have lost your mysql password and unable to reset it. Follow this blog post to know how to reset MySQL password

Step-1: Restart MySQL

sudo /etc/init.d/mysql stop

sudo /etc/init.d/mysqld stop

Step-2: MySQL safe mode

Enter in safe mode and you can access the mysql without using any credentials, after that you can set the password using the query below,

sudo mysqld_safe --skip-grant-tables


mysql -uroot

use mysql;

update user set authentication_string=PASSWORD("mynewpassword") where User='root';

flush privileges;

quit

Restart MySQL (Ubuntu)

sudo /etc/init.d/mysql stop

sudo /etc/init.d/mysql start

Restart MySQL (CentOS)

sudo /etc/init.d/mysqld stop

sudo /etc/init.d/mysqld start

Error while restarting MySQL

You might see the error beolow, when you try to start mysql, use the resolution show in below steps,

mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.

Resolution

mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
mysqld_safe --skip-grant-tables

MySql

Primary Sidebar

en English
ar Arabiczh-CN Chinese (Simplified)nl Dutchen Englishfr Frenchde Germanhi Hindiid Indonesianit Italianja Japanesems Malaypt Portugueseru Russianes Spanishte Telugu

Course Tags

concurrency free go golang

Recent Posts

  • Roadmap to Mastery
  • Increase SSH connection timeout
  • Check Certificate expiry in Kubernetes
  • space invaders in golang
  • creating kubernetes cluster using eksctl
  • Facebook
  • GitHub
  • YouTube

Contact

Navigation

  • goacademy pro

Footer

  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

info@gitopscentral.com


+91 8341443220

© Copyright 2016-2024 gitopscentral · All Rights Reserved ·