mysql版本5.7.37升级到5.7.39。
由于我们由于我们安装mysql的方式是通过mysql-5.7.23-1.el7.x86_64.rpm-bundle.tar中的rpm包安装。
所以升级的方式是专门针对这种方式:rpm -ivh mysql-community-*.rpm --nodeps --forece。
一、检查当前版本
1、检查是否是RPM安装
[root@localhost ~]# rpm -qa |grep -i mysql
2、查看版本
[root@localhost ~]# mysql -V
3、进入/tmp目录中,解压的mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar所需安装包到/tmp目录下
[root@localhost ~]# cd /tmp
[root@localhost tmp]# ls
二、备份数据库,以防升级失败
三、升级操作
1、设置参数使数据库关闭时会清空缓存避免版本间缓存格式差异(以实际数据库操作,我的是root)
[root@localhost tmp]# mysql -u root -p --execute="SET GLOBAL innodb_fast_shutdown=0"
2、关闭数据库(升级完成后记得重启)
查看:[root@localhost tmp]# systemctl status mysqld.service
关闭:[root@localhost tmp]# systemctl stop mysqld.service
3、进入/tmp目录下执行升级操作
[root@localhost ~]# cd /tmp
(tmp如果没有赋权需要赋权可以ll查看一下:[root@localhost ~]# chmod -R 777 /tmp)
[root@localhost tmp]# ls
[root@localhost tmp]# rpm -Uvh mysql-community-*.rpm --nodeps --force
4、打开数据库服务
[root@localhost tmp]# systemctl start mysqld.service
[root@localhost tmp]# systemctl status mysqld.service
查看是否自启:[root@localhost tmp]# systemctl list-unit-files | grep mysqld.service
设置自启动:[root@localhost tmp]# systemctl enable mysqld.service
设置自启动关闭:[root@localhost tmp]# systemctl disable mysqld.service
5、检查并可能解决旧数据和升级软件之间的任何不兼容性(以实际数据库操作,我的是root)
[root@localhost bin]# mysql_upgrade -uroot -p
Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
The sys schema is already up to date (version 1.5.2).
Checking databases.
smp.gen_table OK
smp.gen_table_column OK
smp.light_config OK
smp.qrtz_blob_triggers OK
smp.qrtz_calendars OK
smp.qrtz_cron_triggers OK
smp.qrtz_fired_triggers OK
smp.qrtz_job_details OK
smp.qrtz_locks OK
smp.qrtz_paused_trigger_grps OK
smp.qrtz_scheduler_state OK
smp.qrtz_simple_triggers OK
smp.qrtz_simprop_triggers OK
smp.qrtz_triggers OK
smp.red_captcha OK
smp.red_user OK
smp.smp_alarm_type OK
smp.smp_capability_data OK
smp.smp_capability_dict OK
smp.smp_command_info OK
smp.smp_command_log OK
smp.smp_device_import_his OK
smp.smp_device_model OK
smp.smp_device_rate_statistics OK
smp.smp_device_type OK
smp.smp_operation_principal OK
smp.smp_operation_principal_dept OK
smp.smp_operation_unit OK
smp.smp_operation_unit_dept OK
smp.smp_operation_work_orders OK
smp.smp_snm_manage OK
smp.snm_alarm_info OK
smp.snm_device_capaility OK
smp.snm_device_info OK
smp.snm_device_netmon OK
smp.snm_device_netmon_config OK
smp.snm_device_perform OK
smp.snm_device_search OK
smp.snm_device_version OK
smp.snm_out_device_info OK
smp.snm_perform_dict OK
smp.snm_takephoto_camera_config OK
smp.snm_takephoto_camera_pic OK
smp.snm_trafficlight_dict OK
smp.sys_config OK
smp.sys_dept OK
smp.sys_dict_data OK
smp.sys_dict_type OK
smp.sys_job OK
smp.sys_job_log OK
smp.sys_logininfor OK
smp.sys_menu OK
smp.sys_notice OK
smp.sys_oper_log OK
smp.sys_post OK
smp.sys_role OK
smp.sys_role_dept OK
smp.sys_role_menu OK
smp.sys_user OK
smp.sys_user_post OK
smp.sys_user_role OK
sys.sys_config OK
Upgrade process completed successfully.
Checking if update is needed.
6、rpm验证
[root@localhost tmp]# rpm -qa |grep -i mysql
7、查看mysql版本命令
[root@localhost tmp]# mysql -V
8、进入msyql系统后验证
[root@localhost tmp]# mysql -uroot -p
mysql> select version();
mysql> show databases;
mysql> use mysql
mysql> select user,host from user;
标签:tmp,39,OK,mysql5.7,37,smp,mysql,root,localhost From: https://blog.51cto.com/u_1969518/5759244