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

Basic knowledge of database password management

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

Share

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

Title index

Summary of common sense

Summary of common sense

Basic knowledge after installing data

1. Change the user's password

Method 1: use the SET PASSWORD command

Mysql-u rootMariaDB [(none)] > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' newpass')

Method 2: edit the user table with update

Mysql-u rootMariaDB [(none)] > update mysql.user set password=PASSWORD ('weibodu') where user='root' and host='localhost'

Method 3: use client tools

Mysqladmin-u root password "newpass" if root has already set a password, use the following method mysqladmin-u root password oldpass "newpass"

two。 Delete anonymous useless account

MariaDB [(none)] > delete from mysql.user where host='127.0.0.1';MariaDB [(none)] > delete from mysql.user where host='localhost'

# mysql_secure_installation to replace the first two command line operations #

3. When you forget the root user password

Step 1: stop the mariadb service

Step 2: edit the service profile

# vim / etc/ my.cnf [mysqld] datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.socksymbolic-links=0# add the following line skip-grant-tables

Step 3: restart the database service and log in

# mysql-uMariaDB [(none)] > update mysql.user set password=PASSWORD ('weibodu') where user='root' and host='localhost'

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

Wechat

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

12
Report