How to change mysql password under Centos

How to change mysql password under Centos

1. Modify MySQL login settings:

# vim /etc/my.cnf

Add a sentence: skip-grant-tables

like:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

2. Restart mysql

# service mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]

3. Change Password

mysql> USE mysql;
Database changed
mysql> UPDATE user SET Password = password ('new password') WHERE User = 'root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit

4. Modify the configuration file you just modified

# vim /etc/my.cnf

5. Restart mysql

# service mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]

The above is the method of changing the MySQL password under CentOS introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • How to quickly modify the root password under CentOS8
  • CentOS 7 set grub password and single user login example code
  • How to change the password of mysql5.7.20 under linux CentOS 7.4
  • How to reset the root password in CentOS7
  • How to modify the root password of MySQL in CentOS environment
  • Solution to the problem of still having to enter a password after configuring ssh password-free login in centos
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • CentOS 7 Forgot Password Solution Process Diagram

<<:  What are the new features of Apache Spark 2.4, which will be released in 2018?

>>:  Javascript to achieve the effect of closing advertisements

Recommend

Using CSS to implement image frame animation and curve motion

The basic principle of all animations is to displ...

CSS code to achieve background gradient and automatic full screen

CSS issues about background gradient and automati...

JS implements multiple tab switching carousel

Carousel animation can improve the appearance and...

A brief discussion on logic extraction and field display of Vue3 in projects

Table of contents Logical Layering Separate busin...

Usage and difference of Js module packaging exports require import

Table of contents 1. Commonjs exports and require...

MySQL 8.0.17 installation graphic tutorial

This article shares with you the MySQL 8.0.17 ins...

Is it true that the simpler the web design style, the better?

Original address: http://www.webdesignfromscratch...

Dissecting the advantages of class over id when annotating HTML elements

There are very complex HTML structures in web pag...

Pure CSS to achieve left and right drag to change the layout size

Utilize the browser's non- overflow:auto elem...

Why should the number of rows in a single MySQL table not exceed 5 million?

Today, let’s discuss an interesting topic: How mu...

VUE Getting Started Learning Event Handling

Table of contents 1. Function Binding 2. With par...

2017 latest version of windows installation mysql tutorial

1. First, download the latest version of MySQL fr...