How to modify the root user name in centos and modify the root user name in mysql

How to modify the root user name in centos:

1. Replace root with the username you want to modify in /etc/passwd, then save and exit;

2. Replace root with the user name you want to modify in /etc/shadow, then save and exit;
the method to modify the MYSQL user name:

After MySQL 5.7, the password field has been deleted from the mysql.user table, and the new field name is "authenticalion_string"

use mysql;
So the method to modify the user name in mysql is as follows:
update user set authentication_string=password("Asat123@") where user="cdzx" and Host="localhost";
refresh command: flush privileges;

The method to modify the root user name
update user set user="newName" where user="root";

flush privileges;

Finally, modify the method of displaying your user name when logging in:
add the following to the /etc/profile file:

Command to display user information: export PS1='[\u@\h\w]'

Finally use the command to make it effective: source /etc/profile command.

Guess you like

Origin blog.csdn.net/weixin_44881103/article/details/103079232