mysql数据对比工具
导读:笔者最近在采用 trino 代替旧有方案进行媒体接口数据拉取。需通过将 trino 拉取的数据入到测试库,并与旧方案拉取到生产库中的数据进行对比从而验证逻辑准确性。在进行数据对比时为提高效率因此...
2024.11.21近期,协助一客户重置mysql 8.0.11的root密码,碰到了奇怪的问题。
操作系统版本:rhel 7.6
数据库版本:mysql 8.0.11
根据mysql 8.0官方文档说明,mysql的用户密码有限制,并且被硬编码,没有明确说明密码长度是多少。
Warning
The MySQL user name length limit is hardcoded in MySQL servers and clients, and trying to circumvent it by modifying the definitions of the tables in the mysql database does not work.
You should never alter the structure of tables in the mysql database in any manner whatsoever except by means of the procedure that is described in Section 2.11, “Upgrading MySQL”. Attempting to redefine MySQL‘s system tables in any other fashion results in undefined and unsupported behavior. The server is free to ignore rows that become malformed as a result of such modifications.
另外,mysql 8.0不再支持password()函数,因此,不能像mysql5.x那样通过update mysql.user表来修改用户密码。
但是,在mysql 8.0的root密码重置时遇到报错:
[mysql@mysql8~]$ mysql -uroot -p -S /home/mysql/mysql/tmp/mysql.sock Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 8.0.11 MySQL Community Server - GPL Copyright (c) 2000, 2018, 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> 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 --update mysql.user重置用户密码失败 mysql> update user set authentication_string = ‘123456‘ where user=‘root‘ and host=‘%‘ ; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> select user,host,authentication_string from mysql.user; +------------------+-----------+------------------------------------------------------------------------+ | user | host | authentication_string | +------------------+-----------+------------------------------------------------------------------------+ | root | % | 123456 | | mysql.infoschema | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | +------------------+-----------+------------------------------------------------------------------------+5 rows in set (0.00 sec)
--password函数不被mysql8.0支持
mysql> update user set authentication_string =PASSWORD(‘123456‘) where user=‘root‘ and host=‘%‘ ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(‘123456‘) where user=‘root‘ and host=‘%‘‘ at line 1 mysql>--奇怪的是使用alter命令重置root密码长度为6位时报错,但是不是语法错误
mysql> alter user ‘root‘@‘%‘ identified by ‘123456‘; ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘%‘ --但是,将root密码长度增加到8位时获得成功mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY ‘123456789‘; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> select user,host,authentication_string from mysql.user; +------------------+-----------+------------------------------------------------------------------------+ | user | host | authentication_string | +------------------+-----------+------------------------------------------------------------------------+ | root | % | *CC67043C7BCFF5EEA5566BD9B1F3C74FD9A5CF5D | | mysql.infoschema | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | +------------------+-----------+------------------------------------------------------------------------+ 5 rows in set (0.00 sec)但是,我本地的centos 7.6上的mysql 8.0重置root密码缺没有密码长度限制,两套库用的是相同的参数文件。
官方关于用户密码长度没有特别说明,网上也没有类似密码长度问题的资料,很奇怪!
导读:笔者最近在采用 trino 代替旧有方案进行媒体接口数据拉取。需通过将 trino 拉取的数据入到测试库,并与旧方案拉取到生产库中的数据进行对比从而验证逻辑准确性。在进行数据对比时为提高效率因此...
2024.11.21MySQL数据库扩展和分布式随着数据量的增加和访问量的上升,数据库的扩展变得至关重要。MySQL提供了多种方法来实现数据库的扩展和分布式部署,以应对不断增长的需求。本文将介绍数据库扩展的方法,以及在分...
2024.11.20修改MySQL数据库名称的方法如下:1.语句修改法:rename DATABASE db_name TO new_db_name这个语法在mysql 5.1.7中被添加进来,到了5.1.23又去掉了。...
2024.11.20在MySQL 5.1.7版本中提供了修改数据库名称的SQL语句,语法格式如下:rename DATABASE db_name TO new_db_name但是从 MySQL 5.1.23 版本之后,就...
2024.11.20前言什么是binlogmysql中有各种类型的日志,记录了mysql包括启动、运行、连接、更改等各种操作,而binlog就是其中最重要的一种日志,它记录了MySQL所有数据的变更,并以二进制的形式存储...
2024.11.20