升级方式:
mysql-8.4.3-linux-glibc2.17-x86_64.tar.xz 之间替换安装文件
升级之前my.cnf检查
mysqld --validate-config
mysql@s2:/home/db/mysql$ mysqld --validate-config
2024-11-09T21:29:23.618756+08:00 0 [Note] [MY-013667] [Server] Error-log destination "stderr" is not a file. Can not restore error log messages from previous run.
2024-11-09T21:29:23.615003+08:00 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2024-11-09T21:29:23.626830+08:00 0 [Note] [MY-010747] [Server] Plugin 'FEDERATED' is disabled.
2024-11-09T21:29:23.627347+08:00 0 [Note] [MY-010747] [Server] Plugin 'ndbcluster' is disabled.
2024-11-09T21:29:23.627426+08:00 0 [Note] [MY-010747] [Server] Plugin 'ndbinfo' is disabled.
2024-11-09T21:29:23.627586+08:00 0 [Note] [MY-010747] [Server] Plugin 'ndb_transid_mysql_connection_map' is disabled.
2024-11-09T21:29:23.628921+08:00 0 [Note] [MY-015019] [Server] MySQL Server: Plugins Shutdown - start.
2024-11-09T21:29:23.629015+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'MyISAM'
2024-11-09T21:29:23.629136+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'CSV'
2024-11-09T21:29:23.629343+08:00 0 [Note] [MY-015020] [Server] MySQL Server: Plugins Shutdown - end
注意:
所有含有slave字段的参数都要替换为replicate
# replica_parallel_type=LOGICAL_CLOCK
replica_parallel_workers=4
replica_preserve_commit_order=1
replica_pending_jobs_size_max=32M
# replica_rows_search_algorithms='INDEX_SCAN,HASH_SCAN'
在这里插入代码片
replica_parallel_type 已经放弃使用;
replica_rows_search_algorithms 已经放弃使用;
升级之前的mysqlcheck
[root@s2 ~]# mysqlcheck -u root -p --all-databases --check-upgrade
执行升级:
mysqld --upgrade=FORCE
升级后的检查:
[root@s2 ~]# mysqlcheck -u root -p --all-databases --check-upgrade
Enter password:
data_recovered.sys_columns OK
data_recovered.sys_fields OK
data_recovered.sys_indexes OK
data_recovered.sys_tables OK
mydb.t OK
mydb.t2 OK
mysql.columns_priv Table is already up to date
mysql.component Table is already up to date
mysql.db Table is already up to date
mysql.default_roles Table is already up to date
mysql.engine_cost Table is already up to date
mysql.func Table is already up to date
mysql.general_log Table is already up to date
mysql.global_grants Table is already up to date
mysql.gtid_executed Table is already up to date
mysql.help_category Table is already up to date
mysql.help_keyword Table is already up to date
mysql.help_relation Table is already up to date
mysql.help_topic Table is already up to date
mysql.innodb_index_stats Table is already up to date
mysql.innodb_table_stats Table is already up to date
mysql.ndb_binlog_index Table is already up to date
mysql.password_history Table is already up to date
mysql.plugin Table is already up to date
mysql.procs_priv Table is already up to date
mysql.proxies_priv Table is already up to date
mysql.replication_asynchronous_connection_failover Table is already up to date
mysql.replication_asynchronous_connection_failover_managed Table is already up to date
mysql.replication_group_configuration_version Table is already up to date
mysql.replication_group_member_actions Table is already up to date
mysql.role_edges Table is already up to date
mysql.server_cost Table is already up to date
mysql.servers Table is already up to date
mysql.slave_master_info Table is already up to date
mysql.slave_relay_log_info Table is already up to date
mysql.slave_worker_info Table is already up to date
mysql.slow_log Table is already up to date
mysql.tables_priv Table is already up to date
mysql.time_zone Table is already up to date
mysql.time_zone_leap_second Table is already up to date
mysql.time_zone_name Table is already up to date
mysql.time_zone_transition Table is already up to date
mysql.time_zone_transition_type Table is already up to date
mysql.user Table is already up to date
query_rewrite.rewrite_rules OK
sys.sys_config Table is already up to date
test.gt1 OK
test.t OK
test.ta OK
test.z OK
test.z003 OK
test.z011 OK
test.z02 OK
test.zz01 OK
登录提升错误
ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded
错误原因,8.4.0版本开始默认不再加载mysql_native_password认证插件,默认为caching_sha2_password。需要在my.cnf的mysqld中添加mysql_native_password=on,重启数据库冲击激活mysql_native_password插件
mysql@s2:/home/db/mysql$ cat /etc/my.cnf | grep nativemysql_native_password=ON
登录数据库 创建或更改用户为caching_sha2_password
root@localhost 21:45:13 [mysql]>select user,host ,plugin from user ;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | mysql_native_password |
| mysql.sys | localhost | mysql_native_password |
| qn | localhost | mysql_native_password |
| root | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
5 rows in set (0.00 sec)root@localhost 21:46:30 [mysql]>alter user qn@localhost identified with 'caching_sha2_password' by 'Qn.12345'-> ;
Query OK, 0 rows affected (0.03 sec)root@localhost 21:46:59 [mysql]>root@localhost 21:48:19 [(none)]>create user root@'%' identified with 'caching_sha2_password' by 'Root.12345';
Query OK, 0 rows affected (0.04 sec)root@localhost 21:48:50 [(none)]>flush privileges ;
Query OK, 0 rows affected (0.02 sec)root@localhost 21:49:35 [mysql]>select user,host ,plugin,authentication_string from user ;
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| user | host | plugin | authentication_string |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| root | % | caching_sha2_password | $A$005$BggW#FLw5)t=&ZUBqZdUCLbhr8lI1i6DXBkg7L3mGNvSiNNaVyk6qOK0 |
| mysql.infoschema | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| qn | localhost | caching_sha2_password | $A$005$<t=/LD4)|B
YinB.5kz7Nm43Tn52Dur1c9wPV4rxpMa97HV1rs8DiA | "1pq9o
| root | localhost | mysql_native_password | *D6DBA8A377B96FE04C82882094C41AB742ED0332 |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
6 rows in set (0.00 sec)
my.cnf注释掉mysql_native_password,重启库,重新登录测试
mysql@s2:/home/db/mysql$ mysql -uqn -pQn.12345
mysql: [Warning] Using a password on the command line interface can be insecure.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.qn@localhost 21:57:14 [(none)]>exit
Bye
mysql@s2:/home/db/mysql$ mysql -uroot -pRoot.0101
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded
mysql@s2:/home/db/mysql$
mysql@s2:/home/db/mysql$
mysql@s2:/home/db/mysql$ mysql -uroot -pRoot.0101 -hlocalhost -P3306
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded
mysql@s2:/home/db/mysql$ mysql -uroot -pRoot.12345 -h192.168.99.13 -P3306
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.99.13:3306' (111)mysql@s2:/home/db/mysql$ mysql -uroot -pRoot.12345 -h192.168.99.13 -P13306
mysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.
our MySQL connection id is 17
Server version: 8.4.3 MySQL Community Server - GPLCopyright (c) 2000, 2024, Oracle and/or its affiliates.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.root@192.168.99.13 21:58:34 [(none)]>
root@192.168.99.13 21:58:34 [(none)]>