In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you how to solve the Mysql database report ERROR 1045 28000 errors and MySQL forgot password recovery methods, the article is rich in content and professional analysis and description for you, after reading this article, I hope you can get something.
Case: Mysql database reported ERROR 1045 (28000) error; at the same time, this method is suitable for forgetting MySQL Password recovery; reinstalling mysql manually emptying mysqld.log log files results in loss of initial Password Password modification
Case 1:
[root@zrbapp02 lib] #
[root@zrbapp02 lib] # mysql-uroot-pmysql
Mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@zrbapp02 lib] #
[root@zrbapp02 lib] #
Case 2:
[root@zrbapp02 ~] # echo "" > / var/log/mysqld.log-cannot be found after emptying the mysqld.log log file
[root@zrbapp02 ~] #
[root@zrbapp02 ~] # grep 'temporary password' / var/log/mysqld.log-- initial Password not found in mysqld.log log file
[root@zrbapp02 ~] #
[root@zrbapp02 ~] #
[root@zrbapp02 ~] # systemctl restart mysqld
[root@zrbapp02 ~] #
Solution:
1. Modify the [mysqld] section of / etc/my.cnf file to add skip-grant-tables to skip authentication.
[root@zrbapp02 lib] # vi / etc/my.cnf
# socket=/mysqldb/mysql/mysql.sock
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
Skip-grant-tables
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128m
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128m
# sort_buffer_size = 2m
# read_rnd_buffer_size = 2m
# datadir=/var/lib/mysql
Datadir=/mysqldb/mysql
Socket=/var/lib/mysql/mysql.sock
# socket=/mysqldb/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
Wq!-Save and exit
2. Restart the mysql database
[root@zrbapp02 lib] # systemctl restart mysqld
[root@zrbapp02 lib] #
3. Log in to the database without secret and modify Password
[root@zrbapp02 lib] #
[root@zrbapp02 lib] # mysql
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.7.25 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql >
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | sys |
+-+
4 rows in set (0.24 sec)
Mysql >
Mysql > use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
Mysql >
Mysql >
Mysql > update mysql.user set authentication_string=password ('mysql') where user='root'
Query OK, 1 row affected, 1 warning (0.14 sec)
Rows matched: 1 Changed: 1 Warnings: 1
Mysql >
Mysql > flush privileges
Query OK, 0 rows affected (0.00 sec)
Mysql >
Mysql > exit
Bye
[root@zrbapp02 lib] #
[root@zrbapp02 lib] #
4. Comment out skip-grant-tables
[root@zrbapp02 lib] # vi / etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
# skip-grant-tables
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128m
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128m
# sort_buffer_size = 2m
# read_rnd_buffer_size = 2m
# datadir=/var/lib/mysql
Datadir=/mysqldb/mysql
Socket=/var/lib/mysql/mysql.sock
# socket=/mysqldb/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
Wq!-Save and return!
5. Restart the mysql database
[root@zrbapp02 lib] # systemctl restart mysqld
[root@zrbapp02 lib] #
6. Log in to the database using the new Password
[root@zrbapp01 ~] #
[root@zrbapp01] # mysql-uroot-pmysql
Mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 4
Server version: 5.7.25
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql >
Mysql > show databases;-ALTER USER rest Password is required when viewing the database
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Mysql >
Mysql > alter user'root'@'localhost' identified by'mysql';-reset Password prompts Password rule problem, simple Password cannot be used
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Mysql >
Mysql >
If you need to set a simple Password, you can set the Password rule as follows
Mysql > set global validate_password_policy=0
Query OK, 0 rows affected (0.00 sec)
Mysql > set global validate_password_mixed_case_count=0
Query OK, 0 rows affected (0.00 sec)
Mysql > set global validate_password_number_count=3
Query OK, 0 rows affected (0.00 sec)
Mysql > set global validate_password_special_char_count=0
Query OK, 0 rows affected (0.01 sec)
Mysql > set global validate_password_length=3
Query OK, 0 rows affected (0.00 sec)
Mysql > alter user'root'@'localhost' identified by'mysql'
Query OK, 0 rows affected (0.00 sec)
Mysql >
Mysql >
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | sys |
+-+
4 rows in set (0.00 sec)
Mysql >
Mysql > use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
Mysql >
Mysql >
The above is the editor for you to share how to solve the Mysql database report ERROR 1045 28000 error and MySQL forgot the password recovery method, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.