Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to effectively manage user passwords in Mysql Database

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following is mainly to bring you effective management of Mysql database user passwords, I hope these contents can bring you practical use, which is also the main purpose of my article on effectively managing Mysql database user passwords. All right, don't talk too much nonsense, let's just read the following.

Database is a very important link in the information system, and it is very important to manage it reasonably and efficiently. Usually, the chief administrator creates different administrative accounts, then assigns different operation permissions, and calls these accounts to the appropriate managers to use. The user information for Mysql is stored in the user table in the mysql library. I. user management

1. New user:

CREATE USER 'username' @ 'host' IDENTIFIED BY PASSWORD 'password'

two。 Delete user

DROP USER 'username' @ 'host'

3. Rename:

RENAME USER 'user name' @ 'host' TO 'modified user name' @ 'modified host'; two. Set the password for the user:

1. Modify the password of the currently logged-in user:

SET PASSWORD=PASSWORD ('password')

two。 Change other user passwords:

SET PASSWORD FOR 'username' @ 'host' = PASSWORD ('password')

3. The solution to forgetting your root password:

1) close the database

Systemctl stop mysqld.service

2) check whether the port is closed.

Netstat-antp | grep 3306

3) Log in by skipping user verification. Go to the mysql configuration file, add the following under mysqld, and restart the service.

Vim / etc/ my.cnf [mysqld] user = mysqlbasedir = / usr/local/mysqldatadir = / usr/local/mysql/dataport = 3306character_set_server=utf8pid-file = / usr/local/mysql/mysqld.pidsocket = / usr/local/mysql/mysql.sockserver-id = 1skip-grant-tables # join this command

4) restart the service

Systemctl restart mysqld.service

5. Enter mysql directly into the mysql database. No password is required at this time.

Mysql

6. Then use the following statement to change the password:

Update mysql.user set authentication_string=password ('qwe123') where user='root'

7. Exit the mysql database and enter the configuration file to delete the statement skip-grant-tables added before.

Exit removes statements that log in by skipping user verification

8. Restart the database service, enter the database, and log in with your changed password.

Systemctl restart mysqld.service mysql-uroot-p modified password

For the above about how to effectively manage Mysql database user passwords, we do not think it is very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report