In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1 change the user password normally
If you remember the password, there are three ways to change the user's password:
(1) SET PASSWORD [FOR 'user'@'host'] = PASSWORD (' cleartext password')
(2) UPDATE mysql.user SET Password=PASSWORD ('cleartext password') WHERE User='USERNAME' AND Host='HOST'
(3) mysqladmin-uUSERNAME-hHOST-p password 'NEW_PASS' # can only change the administrator password
Examples
Use the internal key function password () to modify the root password
MariaDB [sunny] > set password for 'root'@'localhost' = password (' Pass123456')
MariaDB [sunny] > flush privileges
Use update to change your password
MariaDB [(none)] > update mysql.user set password=password ('Pass1234') where user='test'
Use mysqladmin to change the administrator password
[root@CentOS7A ~] # mysqladmin-uroot-pPass1234567 password 'Pass123456'
2 forget the administrator password
General steps for the solution:
(1) when starting the mysqld process, use the-- skip-grant-tables and-- skip-networking options; before operation, it is best to disable port 3306 to prevent other users from logging in, or disable network login-- skip-networking
CentOS 7:mariadb.service
CentOS 6:/etc/init.d/mysqld
(2) modify the administrator password through the UPDATE command
(3) start the mysqld process in normal way
The specific steps for CentOS7 to forget the administrator password are as follows
The prerequisite is to have system-level permissions, that is, to start and stop the service, and the steps to crack the administrator password are as follows
First, stop the mysql server
[root@CentOS7A ~] # systemctl stop mariadb.service
Then modify the configuration file
Vim / usr/lib/systemd/system/mariadb.serviceExecStart=/usr/bin/mysqld_safe-basedir=/usr-skip-grant-tables-skip-networking
Reload a file
[root@CentOS7A ~] # systemctl daemon-reload
Restart mqsql
[root@CentOS7A ~] # systemctl restart mariadb
At this point, you can log in to mysql without an account and password.
[root@CentOS7A ~] # mysql
Welcome to the MariaDB monitor. Commands end with; or\ g.
Change the root password after logging in to mysql, and modify the table mysql.user directly using the password function, as follows
MariaDB [(none)] > update mysql.user set password=PASSWORD ('Pass12345678') where user= "root"
After the password update is complete, stop the mysql service, then change the configuration file again, remove the skip option and restart
[root@CentOS7A ~] # systemctl stop mariadb; [root@CentOS7A ~] # vim / usr/lib/systemd/system/mariadb.service ExecStart=/usr/bin/mysqld_safe-basedir=/usr
Reload a file
[root@CentOS7A ~] # systemctl daemon-reload [root@CentOS7A ~] # systemctl restart mariadb
After the mysql service starts successfully, reconnect, and a new password is required to connect. In this case, the password is modified successfully.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.