Tutorial on how to modify the root password in MySQL 5.7

Tutorial on how to modify the root password in MySQL 5.7

Version update, the password field in the original user has been changed to authentication_string

Due to version updates, many online tutorials are no longer applicable, and even the official website's documents cannot be operated smoothly.

If MySQL is running, kill it first:

killall -TERM mysqld.

run

mysqld_safe --skip-grant-tables &

If you do not want to be connected remotely at this time: mysqld_safe –skip-grant-tables –skip-networking &

Use mysql to connect to server

change password:

update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

*One thing to note is that there is no Password field in the user table under the new version of MySQL database.

Instead, the encrypted user password is stored in the authentication_string field

mysql> flush privileges;
mysql> quit;

The modification is completed. Restart

killall -TERM mysqld.
mysqld_safe &

Then mysql can connect

But the operation seems to be incomplete at this time, and you need to alter user...

alter user 'root'@'localhost' identified by '123';

The online article says that this is also possible:

set password for 'root'@'localhost'=password('123');
cp mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • How to modify the root user password in mysql 8.0.16 winx64 and Linux
  • How to correctly modify the ROOT password in MySql8.0 and above versions
  • MySQL 5.6 root password modification tutorial
  • Summary of how to modify the root password in MySQL 5.7 and MySQL 8.0
  • Detailed explanation of the idea of ​​installing mysql8.0.11 and changing the root password and connecting navicat for mysql
  • Multiple methods to modify MySQL root password (recommended)
  • How to change the root password in MySQL 5.7
  • Mysql forget the root password and change the root password solution (summary)
  • How to change the root user's password in MySQL

<<:  Vue2/vue3 routing permission management method example

>>:  VMware Workstation Installation (Linux Kernel) Kylin Graphic Tutorial

Recommend

Let's talk about bitwise operations in React source code in detail

Table of contents Preface Several common bit oper...

CSS to achieve text on the background image

Effect: <div class="imgs"> <!-...

Detailed explanation of Svn one-click installation shell script under linxu

#!/bin/bash #Download SVN yum -y install subversi...

js implements form validation function

This article example shares the specific code of ...

Index in MySQL

Preface Let's get straight to the point. The ...

How to adapt CSS to iPhone full screen

1. Media query method /*iPhone X adaptation*/ @me...

Docker starts Redis and sets the password

Redis uses the apline (Alps) image of Redis versi...

The DOCTYPE mode selection mechanism of well-known browsers

Document Scope This article covers mode switching...

One line of code teaches you how to hide Linux processes

Friends always ask me how to hide Linux processes...

Implementation of Vue top tags browsing history

Table of contents nonsense Functions implemented ...

Abbreviation of HTML DOCTYPE

If your DOCTYPE is as follows: Copy code The code ...

An elegant way to handle WeChat applet authorization login

Preface When the WeChat mini program project invo...

Summary of Linux vi command knowledge points and usage

Detailed explanation of Linux vi command The vi e...