怎么用二進制包安裝mysql-創(chuàng)新互聯(lián)

這篇文章主要講解了“怎么用二進制包安裝mysql”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“怎么用二進制包安裝mysql”吧!

10年積累的網(wǎng)站制作、做網(wǎng)站經(jīng)驗,可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認識你,你也不認識我。但先網(wǎng)站制作后付款的網(wǎng)站建設(shè)流程,更有防城免費網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

目的

本文主要講述如何使用二進制安裝mysql,并啟動mysql

1、mysql安裝包的下載

https://dev.mysql.com/downloads/mysql/

2、安裝mysql前的準(zhǔn)備

  • 上傳mysql安裝包至/usr/local目錄

  • 解壓mysql安裝包;

    [root@localhost local]# tar xvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
  • 將解壓后的文件夾連接至mysql文件夾

    [root@localhost local]# ln -s mysql-5.6.39-linux-glibc2.12-x86_64 mysql
  • 檢查并安裝依賴包(perl)

    [root@localhost scripts]# yum -y install perl perl-devel perl-Data-Dumper
> 如若未安裝perl組件將會報以下錯誤

[root@localhost scripts]# ./mysql_install_db
FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db:
Data::Dumper

- 檢查并安裝依賴包(libaio)

[root@localhost mysql]# yum list|grep libaio
libaio.i686                0.3.109-13.el7         base   
libaio.x86_64               0.3.109-13.el7         base   
libaio-devel.i686             0.3.109-13.el7         base   
libaio-devel.x86_64            0.3.109-13.el7         base   
[root@localhost mysql]# yum -y install libaio libaio-devel

> 若如為安裝libaio組件將會報以下錯誤

[root@localhost mysql]# scripts/mysql_install_db --user=mysql
WARNING: The host 'Alinx' could not be looked up with ./bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !

Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
[root@localhost mysql]#

###  3、創(chuàng)建mysql用戶,用戶組并將目錄授權(quán)給mysql用戶

[root@localhost scripts]# groupadd mysql
[root@localhost scripts]# useradd -r -g mysql mysql
[root@localhost ~]# chown mysql:mysql /usr/local/mysql -R
[root@localhost ~]# ll /usr/local/
total 321180
drwxr-xr-x.  2 root  root      6 Aug 12  2015 bin
drwxr-xr-x.  2 root  root      6 Aug 12  2015 etc
drwxr-xr-x.  2 root  root      6 Aug 12  2015 games
drwxr-xr-x.  2 root  root      6 Aug 12  2015 include
drwxr-xr-x.  2 root  root      6 Aug 12  2015 lib
drwxr-xr-x.  2 root  root      6 Aug 12  2015 lib64
drwxr-xr-x.  2 root  root      6 Aug 12  2015 libexec
lrwxrwxrwx  1 mysql mysql     35 Jan 16 22:46 mysql -> mysql-5.6.39-linux-glibc2.12-x86_64
drwxr-xr-x  13 mysql mysql    4096 Jan 16 22:38 mysql-5.6.39-linux-glibc2.12-x86_64
-rw-r--r--  1 root  root  328882304 Jan 21  2018 mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
drwxr-xr-x.  2 root  root      6 Aug 12  2015 sbin
drwxr-xr-x.  5 root  root     46 Jan 17  2017 share
drwxr-xr-x.  2 root  root      6 Aug 12  2015 src

> 此時可以看到mysql目錄的歸屬為mysql:mysql
- 刪除系統(tǒng)中的mysql配置文件

rm -f /etc/my.cnf
rm -fr /etc/my.cnf.d/

### 4、初始化并啟動mysql
- 初始化

[root@localhost mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --skip-name-resolve

> 該步驟為創(chuàng)建了一個root用戶(空密碼),并初始化了mysql的一些權(quán)限賬戶表

- 拷貝配置文件以及啟動腳本

[root@localhost mysql]# cp support-files/my-default.cnf /etc/my.cnf
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld

- 編輯/etc/my.cnf文件,并寫入如下內(nèi)容

basedir = /usr/local/mysql
datadir = /usr/local/mysql/data/

### 5、啟動mysql

- 啟動mysql

/usr/local/mysql/support-files/mysqld start

- 為mysql數(shù)據(jù)庫設(shè)置密碼(跟進提示進行密碼設(shè)置,部署完時密碼為空)

[root@localhost mysql]# ./bin/mysql_secure_installation

- 登錄數(shù)據(jù)庫

[root@localhost mysql]# mysql -uroot -pAlinx

> 當(dāng)前啟動時候報錯(發(fā)現(xiàn)是/etc/my.cnf未配置目錄導(dǎo)致)

[root@localhost support-files]# /usr/local/mysql/support-files/mysql.server start
Starting MySQL.Logging to '/usr/local/mysql/data/localhost.err'.
ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.pid).
[root@localhost support-files]#

感謝各位的閱讀,以上就是“怎么用二進制包安裝mysql”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對怎么用二進制包安裝mysql這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

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

網(wǎng)頁標(biāo)題:怎么用二進制包安裝mysql-創(chuàng)新互聯(lián)
URL地址:http://bm7419.com/article36/dgdepg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、網(wǎng)站設(shè)計企業(yè)網(wǎng)站制作、虛擬主機電子商務(wù)、建站公司

廣告

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

營銷型網(wǎng)站建設(shè)