MySQL5.6.38在RedHat6.5上通過(guò)RPM包安裝-創(chuàng)新互聯(lián)

一、安裝環(huán)境

從網(wǎng)站建設(shè)到定制行業(yè)解決方案,為提供成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)服務(wù)體系,各種行業(yè)企業(yè)客戶提供網(wǎng)站建設(shè)解決方案,助力業(yè)務(wù)快速發(fā)展。成都創(chuàng)新互聯(lián)將不斷加快創(chuàng)新步伐,提供優(yōu)質(zhì)的建站服務(wù)。

1、操作系統(tǒng)版本:Red Hat Enterprise Linux Server release 6.5 (Santiago)

2、Mysql版本:MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar

二、安裝說(shuō)明

網(wǎng)上不少資料在使用rpm包安裝Mysql 5.6之前,都會(huì)先卸載系統(tǒng)自帶的mysql-libs,但有的資料是用yum remove mysql,但這樣會(huì)把依賴mysql-libs的8個(gè)包也一同卸載,其中就包括postfix、crontab等軟件包,造成了非預(yù)期目的的卸載,有的資料就使用rpm -e --nodeps mysql-libs來(lái)避免卸載其他依賴mysql-libs的軟件包,但是也并非完全正確的做法,Mysql官方提供的Mysql-shared-compat正是替代mysql-libs的rpm包,應(yīng)先安裝此包,再單獨(dú)卸載mysql-libs,官方說(shuō)明如下:

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

解壓MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar后,可以看到包含了多個(gè)rpm包文件

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

網(wǎng)上不少資料都選擇了安裝Mysql-server、Mysql-client和Mysql-devel三個(gè)包,但實(shí)際上Mysql-devel的作用是如果需要編譯其他mysql客戶端例如perl mysql模塊或者打算編譯C API應(yīng)用程序,實(shí)際上大多數(shù)情況下標(biāo)準(zhǔn)安裝并不需要安裝Mysql-devel,只需要按照Mysql-server和Mysql-client就行,本文就是這樣安裝。官網(wǎng)的介紹如下:

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

三、安裝過(guò)程

1、首先安裝一下Mysql-shared-compat,再單獨(dú)卸載mysql-libs。

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

2、安裝mysql-server,根據(jù)提示安裝完成后的隨機(jī)密碼在/root/.mysql_secret,并且可以運(yùn)行安全配置向?qū)?usr/bin/mysql_secure_installation,還有配置文件在/usr/my.cnf(按習(xí)慣一般拷貝到/etc/my.cnf)

[root@node01 mysqlrpm]# rpm -ivh MySQL-server-5.6.38-1.el6.x86_64.rpm warning: MySQL-server-5.6.38-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing...                ########################################### [100%]    1:MySQL-server           ########################################### [100%] warning: user mysql does not exist - using root warning: group mysql does not exist - using root warning: user mysql does not exist - using root warning: group mysql does not exist - using root 2017-10-28 20:57:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-10-28 20:57:24 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2017-10-28 20:57:24 0 [Note] /usr/sbin/mysqld (mysqld 5.6.38) starting as process 8869 ... 2017-10-28 20:57:24 8869 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-10-28 20:57:24 8869 [Note] InnoDB: The InnoDB memory heap is disabled 2017-10-28 20:57:24 8869 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-10-28 20:57:24 8869 [Note] InnoDB: Memory barrier is not used 2017-10-28 20:57:24 8869 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-10-28 20:57:24 8869 [Note] InnoDB: Using Linux native AIO 2017-10-28 20:57:24 8869 [Note] InnoDB: Using CPU crc32 instructions 2017-10-28 20:57:24 8869 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-10-28 20:57:24 8869 [Note] InnoDB: Completed initialization of buffer pool 2017-10-28 20:57:24 8869 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2017-10-28 20:57:24 8869 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2017-10-28 20:57:24 8869 [Note] InnoDB: Database physically writes the file full: wait... 2017-10-28 20:57:25 8869 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2017-10-28 20:57:26 8869 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2017-10-28 20:57:27 8869 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2017-10-28 20:57:27 8869 [Warning] InnoDB: New log files created, LSN=45781 2017-10-28 20:57:27 8869 [Note] InnoDB: Doublewrite buffer not found: creating new 2017-10-28 20:57:27 8869 [Note] InnoDB: Doublewrite buffer created 2017-10-28 20:57:27 8869 [Note] InnoDB: 128 rollback segment(s) are active. 2017-10-28 20:57:27 8869 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-10-28 20:57:27 8869 [Note] InnoDB: Foreign key constraint system tables created 2017-10-28 20:57:27 8869 [Note] InnoDB: Creating tablespace and datafile system tables. 2017-10-28 20:57:27 8869 [Note] InnoDB: Tablespace and datafile system tables created. 2017-10-28 20:57:27 8869 [Note] InnoDB: Waiting for purge to start 2017-10-28 20:57:27 8869 [Note] InnoDB: 5.6.38 started; log sequence number 0 A random root password has been set. You will find it in '/root/.mysql_secret'. 2017-10-28 20:57:28 8869 [Note] Binlog end 2017-10-28 20:57:28 8869 [Note] InnoDB: FTS optimize thread exiting. 2017-10-28 20:57:28 8869 [Note] InnoDB: Starting shutdown... 2017-10-28 20:57:29 8869 [Note] InnoDB: Shutdown completed; log sequence number 1625977 2017-10-28 20:57:29 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-10-28 20:57:29 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2017-10-28 20:57:29 0 [Note] /usr/sbin/mysqld (mysqld 5.6.38) starting as process 8891 ... 2017-10-28 20:57:29 8891 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-10-28 20:57:29 8891 [Note] InnoDB: The InnoDB memory heap is disabled 2017-10-28 20:57:29 8891 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-10-28 20:57:29 8891 [Note] InnoDB: Memory barrier is not used 2017-10-28 20:57:29 8891 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-10-28 20:57:29 8891 [Note] InnoDB: Using Linux native AIO 2017-10-28 20:57:29 8891 [Note] InnoDB: Using CPU crc32 instructions 2017-10-28 20:57:29 8891 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-10-28 20:57:29 8891 [Note] InnoDB: Completed initialization of buffer pool 2017-10-28 20:57:29 8891 [Note] InnoDB: Highest supported file format is Barracuda. 2017-10-28 20:57:29 8891 [Note] InnoDB: 128 rollback segment(s) are active. 2017-10-28 20:57:29 8891 [Note] InnoDB: Waiting for purge to start 2017-10-28 20:57:29 8891 [Note] InnoDB: 5.6.38 started; log sequence number 1625977 2017-10-28 20:57:29 8891 [Note] Binlog end 2017-10-28 20:57:29 8891 [Note] InnoDB: FTS optimize thread exiting. 2017-10-28 20:57:29 8891 [Note] InnoDB: Starting shutdown... 2017-10-28 20:57:31 8891 [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'.   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

3、安裝Mysql-client

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

4、復(fù)制my.conf并啟動(dòng)服務(wù)

 [root@node01 mysqlrpm]# cp /usr/my.cnf /etc/my.cnf

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

5、RPM包安裝后的目錄結(jié)構(gòu)如下:

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

四、初始化配置Mysql并登錄數(shù)據(jù)庫(kù)

1、網(wǎng)上很多資料在RPM安裝完Mysql 5.6后還執(zhí)行了/usr/bin/mysql_install_db進(jìn)行初始化安裝但安全配置向?qū)s沒(méi)運(yùn)行,實(shí)際上在Mysql 5.6.8開(kāi)始,用RPM包全新安裝時(shí)會(huì)調(diào)用/usr/bin/mysql_install_db并帶上隨機(jī)密碼參數(shù),因此并不需要再執(zhí)行mysql_install_db,反而運(yùn)行安全配置向?qū)Ш苡斜匾?。官網(wǎng)說(shuō)明如下:

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

2、運(yùn)行安全配置向?qū)?,由于需要輸入root密碼,因此先查看一下隨機(jī)生成的密碼文件。

[root@node01 ~]# cat /root/.mysql_secret # The random password set for the root user at Sat Oct 28 20:57:28 2017 (local time): LyE_R5rVp7p1vLMe

 安全配置向?qū)е饕獔?zhí)行以下操作:

 a)是否為root用戶設(shè)置密碼
 b)是否刪除匿名賬號(hào)
 c)是否取消root用戶遠(yuǎn)程登錄
 d)是否刪除test庫(kù)和對(duì)test庫(kù)的訪問(wèn)權(quán)限
 e)是否刷新授權(quán)表使修改生效

[root@node01 ~]# cat /root/.mysql_secret # The random password set for the root user at Sat Oct 28 20:57:28 2017 (local time): LyE_R5rVp7p1vLMe [root@node01 ~]# /usr/bin/mysql_secure_installation   NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION  USE! PLEASE READ EACH STEP CAREFULLY!   In order to log into MySQL to secure it, we'll need the current password for the root user.  If you've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.   Enter current password for root (enter for none): OK, successfully used password, moving on...   Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation.   You already have a root password set, so you can safely answer 'n'.   Change the root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables..  ... Success!     By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a production environment.   Remove anonymous users? [Y/n] y  ... Success!   Normally, root should only be allowed to connect from 'localhost'.  This ensures that  someone cannot guess at the root password from the network.   Disallow root login remotely? [Y/n] n  ... skipping.   By default, MySQL comes with a database named 'test' that anyone can access.   This is also intended only for testing, and should be removed before moving into a production environment.   Remove test database and access to it? [Y/n] n  ... skipping.   Reloading the privilege tables will ensure that all changes made so far will take effect immediately.   Reload privilege tables now? [Y/n] y  ... Success!   All done!  If you've completed all of the above steps,your MySQL installation should now be secure.   Thanks for using MySQL!   Cleaning up...

3、登錄數(shù)據(jù)庫(kù),確認(rèn)安裝成功完成

MySQL 5.6.38在RedHat 6.5上通過(guò)RPM包安裝

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

本文名稱:MySQL5.6.38在RedHat6.5上通過(guò)RPM包安裝-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://www.muchs.cn/article32/dpcppc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、企業(yè)網(wǎng)站制作、響應(yīng)式網(wǎng)站、企業(yè)建站域名注冊(cè)、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司