Mysql從5.6.14安全升級(jí)至mysql5.6.25的方法
服務(wù)器上Mysql的版本為:社區(qū)版的mysql-community-server-5.6.14。近日局方對(duì)服務(wù)器進(jìn)行漏洞掃描,發(fā)現(xiàn)zhyh08上的mysql存在幾個(gè)高危漏洞,要求進(jìn)行修復(fù)。受這幾個(gè)漏洞影響的主要是5.6.17及以前的版本,所以將mysql升級(jí)至最新的5.6.25即可解決問題。
1、下載最新的mysql安裝包(rpm文件),鏈接如下:
MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar
2、備份數(shù)據(jù)庫(kù)數(shù)據(jù),這里使用的是mysqldump命令。
3、備份/etc/my.cnf:cp /etc/my.cnf /etc/my.cnf_backup
3、停止mysql服務(wù):service mysql stop
4、解壓上面的tar包:tar -xvf MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar
5、確認(rèn)服務(wù)器上所安裝的mysql的各個(gè)組件,這里我們只升級(jí)server和client。
[hadoop@zlyh08 chx]$ rpm -qa|grep -i mysql mysql-community-libs-compat-5.6.14-3.el6.x86_64 mysql-community-devel-5.6.14-3.el6.x86_64 mysql-community-common-5.6.14-3.el6.x86_64 mysql-community-libs-5.6.14-3.el6.x86_64 mysql-community-server-5.6.14-3.el6.x86_64 mysql-community-client-5.6.14-3.el6.x86_64 perl-DBD-MySQL-4.013-3.el6.x86_64 [hadoop@zlyh08 chx]$
6、將server和client卸載:
rpm -e mysql-community-server-5.6.14-3.el6.x86_64 rpm -e mysql-community-client-5.6.14-3.el6.x86_64
注:如若不先卸載的話,安裝時(shí)會(huì)報(bào)文件沖突:
[root@zlyh08 chx]# rpm -Uvh MySQL-server-5.6.25-1.el6.x86_64.rpm Preparing... ########################################### [100%] file /usr/share/mysql/bulgarian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mysql-community-common-5.6.14-3.el6.x86_64 ………… file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mysql-community-common-5.6.14-3.el6.x86_64
7、重新安裝server和client:
[root@zlyh08 chx]# rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-server ########################################### [100%] 2015-07-01 16:02:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2015-07-01 16:02:40 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 28611 ... 2015-07-01 16:02:40 28611 [Note] InnoDB: Using atomics to ref count buffer pool pages 2015-07-01 16:02:40 28611 [Note] InnoDB: The InnoDB memory heap is disabled ………… 2015-07-01 16:02:44 28633 [Note] InnoDB: FTS optimize thread exiting. 2015-07-01 16:02:44 28633 [Note] InnoDB: Starting shutdown... 2015-07-01 16:02:45 28633 [Note] InnoDB: Shutdown completed; log sequence number 1625987 A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! You will find that password in '/root/.mysql_secret'.#竟然沒發(fā)現(xiàn)這一行,難怪裝完一直連不上 ---------- [root@appserver ~]# cat /root/.mysql_secret # The random password set for the root user at Thu Nov 20 15:52:02 2014 (local time): sFpJCf6WLhyYKc35 ---------- You must change that password on your first connect, no other statement but 'SET PASSWORD' will be accepted. See the manual for the semantics of the 'password expired' flag. Also, the account for the anonymous user has been removed. In addition, you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test database. This is strongly recommended for production servers. See the manual for more instructions. Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com New default config file was created as /usr/my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings [root@zlyh08 chx]# rpm -ivh MySQL-client-5.6.25-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%] [root@zlyh08 chx]#
8、恢復(fù)my.cnf:cp /etc/my.cnf_backup /etc/my.cnf
9、啟動(dòng)mysql服務(wù):service mysql start
[root@zlyh08 chx]# service mysql start Starting MySQL... SUCCESS!
10、使用客戶端連接mysql:
[root@zlyh08 mysql-5.6.25]# mysql ERROR 2002 (HY000): Can t connect to local MySQL server through socket '/data1/mysql/mysql.sock' (2)
11、查看/data1/mysql目錄下,確實(shí)沒有mysql.sock文件。
12、查看/etc/my.cnf文件,發(fā)現(xiàn)只在[mysql]下面配置了
[mysql] socket=/data1/mysql/mysql.sock default-character-set=utf8 [mysqld] #mysqld下面沒有配置socket #skip-grant-tables interactive_timeout=300 wait_timeout=300
13、編輯/etc/my.cnf,在[mysqld]下面添加socket的配置,使用服務(wù)器和客戶端都使用同一個(gè)socket文件,如下:
[mysql] socket=/data1/mysql/mysql.sock default-character-set=utf8 [mysqld] #skip-grant-tables socket=/data1/mysql/mysql.sock #增加此行,之前只[mysql]加了這一項(xiàng) interactive_timeout=300 wait_timeout=300
14、重啟mysql服務(wù)。
15、使用升級(jí)前的root用戶連接mysql:
[hadoop@zlyh08 report_script]$ mysql -hzlyh08 -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 233 Server version: 5.6.25 MySQL Community Server (GPL) Copyright (c) 2000, 2015, 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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | apollo_v1.0 | | hive | | log | | metastore | | mysql | | oozie | | performance_schema | | test | +--------------------+ 9 rows in set (0.00 sec) mysql>
16、至此,升級(jí)完成。
以上所述是小編給大家介紹的Mysql從5.6.14安全升級(jí)至mysql5.6.25的方法,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
MySQL中主鍵索引與聚焦索引之概念的學(xué)習(xí)教程
這篇文章主要介紹了MySQL中的主鍵索引與聚焦索引的概念,文中也對(duì)比了兩種索引有何不同,需要的朋友可以參考下2015-11-11解決Mysql5.7.17在windows下安裝啟動(dòng)時(shí)提示不成功問題
這篇文章主要介紹了解決Mysql5.7.17在windows下安裝啟動(dòng)時(shí)提示不成功問題,需要的朋友可以參考下2017-03-03深入Mysql,SqlServer,Oracle主鍵自動(dòng)增長(zhǎng)的設(shè)置詳解
本篇文章是對(duì)Mysql,SqlServer,Oracle主鍵自動(dòng)增長(zhǎng)的設(shè)置進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06mysql一條sql查出多個(gè)條件不同的sum或count問題
這篇文章主要介紹了mysql一條sql查出多個(gè)條件不同的sum或count問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-05-05mysql通過find_in_set()函數(shù)實(shí)現(xiàn)where in()順序排序
這篇文章主要介紹了mysql通過find_in_set()函數(shù)實(shí)現(xiàn)where in()順序排序的相關(guān)內(nèi)容,具有一定參考價(jià)值,需要的朋友可以了解下。2017-10-10mysql表優(yōu)化、分析、檢查和修復(fù)的方法詳解
這篇文章主要介紹了mysql表優(yōu)化、分析、檢查和修復(fù)的方法,結(jié)合實(shí)例形式較為詳細(xì)的分析了MySQL表進(jìn)行優(yōu)化,分析與修復(fù)等操作的各種常見命令與使用技巧,需要的朋友可以參考下2016-04-04MySQL中字段類型char、varchar和text的區(qū)別
今天小編就為大家分享一篇關(guān)于MySQL中字段類型char、varchar和text的區(qū)別,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧2019-03-03