Home > Database > Mysql Tutorial > body text

Two lnmp methods to reset mysql database root password

小云云
Release: 2017-12-25 13:59:45
Original
2193 people have browsed it

This article will use examples to introduce to you two methods of lnmp resetting the root password of the mysql database. The first method is to reset the password through a script, and the second method is to modify it through commands. Please refer to this article for specific operation methods. I hope you can Help everyone.

The first method: Use Jun Ge’s one-click script to modify the MYSQL database password in the LNMP environment

The one-click script is definitely very convenient. Specifically execute the following command:


wget http://soft.vpser.net/lnmp/ext/reset_mysql_root_password.sh
sh reset_mysql_root_password.sh
Copy after login

Convenience!

Second method: Modify through commands, as follows:

a. Stop the MySQL service

Execution: /etc/init.d/ mysql stop

b, skip verification and start MySQL


/usr/local/mysql/bin/mysqld_safe –skip-grant-tables >/dev/null 2>&1 &
Copy after login

Then:


mysql mysql -uroot //登陆
mysql> UPDATE user SET Password=PASSWORD(‘new password') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
Copy after login

Then restart mysql


/etc/init.d/mysql start
Copy after login

Related recommendations:

How to reset MySQL’s Root password

Introduction to the methods of changing the root password and installation and configuration tuning in MySQL

MySQL-How to operate if you forget the Root password

The above is the detailed content of Two lnmp methods to reset mysql database root password. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!