成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

MySQL源碼安裝的方法介紹-創(chuàng)新互聯(lián)

本篇內(nèi)容主要講解“MySQL源碼安裝的方法介紹”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“MySQL源碼安裝的方法介紹”吧!

創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括麥蓋提網(wǎng)站建設(shè)、麥蓋提網(wǎng)站制作、麥蓋提網(wǎng)頁(yè)制作以及麥蓋提網(wǎng)絡(luò)營(yíng)銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,麥蓋提網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到麥蓋提省份的部分城市,未來相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

MYSQL的安裝分三種:命令行安裝、二進(jìn)制安裝和源碼安裝
命令行安裝相對(duì)而言簡(jiǎn)單,我們就不做過多陳述,今天就著重講講MYSQL的源碼安裝
編譯安裝過程描述:

  •     1.下載源代碼

  •     2.檢查源碼編譯所需的依賴包是否齊全

  •     3.解壓編譯

  •     4.make && make install

  •     5.初始化數(shù)據(jù)目錄

  •     6.數(shù)據(jù)庫(kù)權(quán)限設(shè)置

  •     7.定義啟動(dòng)方式

軟件安裝的常規(guī)約定:

  •     軟件安裝包放在/usr/local/src下

  •     軟件根目錄basedir在/usr/local/xxx下,如:/usr/local/mysql

  •     配置文件在/etc/下,如:/etc/my.cnf

  •     數(shù)據(jù)目錄datadir一般放在單獨(dú)的磁盤上

  •     mysql服務(wù)名為mysqld

========
準(zhǔn)備
========
#創(chuàng)建數(shù)據(jù)目錄
[root@xxx ~]# mkdir /data/mysql
#創(chuàng)建根目錄
[root@xxx ~]# mkdir /usr/local/mysqlrp
#進(jìn)入軟件存放目錄
[root@xxx ~]# cd /usr/local/src/
[root@xxx src]# mv /root/mysql-5.6.24.tar.gz .
[root@xxx src]# tar -zxvf mysql-5.6.24.tar.gz
[root@xxx src]# cd mysql-5.6.24
#檢查cmake是否安裝,如果未安裝,請(qǐng)使用yum install cmake或其它方式安裝
[root@xxx mysql-5.6.24]# which cmake
    /usr/bin/cmake
#安裝必備的依賴包
[root@xxx mysql-5.6.24]# yum install ncurses-devel
[root@xxx mysql-5.6.24]# yum install bison
#=======
編譯
#=======
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysqlrp \
-DMYSQL_DATADIR=/data/mysql \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

[root@xxx mysql-5.6.24]# ls /usr/local/mysqlrp/
[root@xxx mysql-5.6.24]#
[root@xxx mysql-5.6.24]# ls /data/mysql/
[root@xxx mysql-5.6.24]#
[root@xxx mysql-5.6.24]# make
[root@xxx mysql-5.6.24]# ls /usr/local/mysqlrp/
[root@xxx mysql-5.6.24]# ls /data/mysql/
[root@xxx mysql-5.6.24]#
#make install時(shí)才會(huì)在根目錄下生成文件
[root@xxx mysql-5.6.24]# make install
[root@xxx mysql-5.6.24]# ls /usr/local/mysqlrp/
    bin      data  include         lib  mysql-test  scripts  sql-bench
    COPYING  docs  INSTALL-BINARY  man  README      share    support-files
[root@xxx mysql-5.6.24]# ls /data/mysql/
[root@xxx mysql-5.6.24]#
[root@xxx mysql-5.6.24]# cd /usr/local/mysqlrp/
#創(chuàng)建mysql管理用戶及組
[root@xxx mysqlrp]# groupadd mysql
[root@xxx mysqlrp]# useradd mysql -g mysql
#修改配置文件,修改根目錄、數(shù)據(jù)目錄位置。
[root@xxx local]# vi /etc/my.cnf
    ...
    [mysqld]
    basedir=/usr/local/mysqlrp   
    datadir=/data/mysql
#初始化數(shù)據(jù)目錄
[root@xxx mysqlrp]# ./scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf &
#制作mysql服務(wù)mysqld
[root@xxx mysqlrp]# cp support-files/mysql.server /etc/init.d/mysqld
#修改各個(gè)目錄對(duì)應(yīng)權(quán)限
[root@xxx mysqlrp]#chown -R mysql.mysql /usr/local/mysqlrp
[root@xxx mysqlrp]#chown -R mysql.mysql  /data/mysql
[root@xxx mysqlrp]#chown mysql.mysql  /etc/my.cnf
[root@xxx mysqlrp]#chown mysql.mysql  /etc/init.d/mysqld
[root@xxx mysqlrp]#chmod -R 755 /usr/local/mysqlrp
[root@xxx mysqlrp]#chmod -R 755 /data/mysql
root@xxx mysqlrp]#chmod  644 /etc/my.cnf
[root@xxx mysqlrp]#chmod 755 /etc/init.d/mysqld
#啟動(dòng)mysql服務(wù)
[root@xxx local]# service mysqld start
   Starting MySQL.          
[  OK  ]

#=======
#源碼編譯常見依賴包
#=======
kernel-headers-2.6.32-358.el6.x86_64.rpm
glibc-headers-2.12-1.107.el6.x86_64.rpm
glibc-devel-2.12-1.107.el6.x86_64.rpm
cpp-4.4.7-3.el6.x86_64.rpm
gcc-4.4.7-3.el6.x86_64.rpm
libstdc++-devel-4.4.7-3.el6.x86_64.rpm
gcc-c++-4.4.7-3.el6.x86_64.rpm
autoconf-2.63-5.1.el6.noarch.rpm
automake-1.11.1-4.el6.noarch.rpm
zlib-1.2.3-29.el6.x86_64.rpm
ncurses-devel-5.7-3.20090208.el6.x86_64.rpm
libgcrypt-1.4.5-9.el6_2.2.x86_64.rpm
libtool-2.2.6-15.5.el6.x86_64.rpm
bison-2.4.1-5.el6.x86_64.rpm

#=======
#附實(shí)驗(yàn)2則,解釋常見疑問
#實(shí)驗(yàn)1說明,數(shù)據(jù)目錄初始化的時(shí)候,必須在根目錄basedir下初始化目錄(具體數(shù)據(jù)目錄可以自定義),使用初始化腳本進(jìn)行初始化。
#實(shí)驗(yàn)2說明,數(shù)據(jù)庫(kù)在編譯的時(shí)候會(huì)修改源碼里面的內(nèi)容,例如src/mysql-5.6.24/support-files/mysql.server ,會(huì)將根目錄修改為編譯時(shí)指定的根目錄
#        數(shù)據(jù)庫(kù)編譯時(shí)指定數(shù)據(jù)目錄,安裝完成后mysql工具沒有指定數(shù)據(jù)目錄且根目錄下沒有data目錄會(huì)優(yōu)先將編譯時(shí)指定的數(shù)據(jù)目錄作為自己的數(shù)據(jù)目錄
#=======

點(diǎn)擊(此處)折疊或打開

  1. #=======

  2.     #實(shí)驗(yàn)1

  3.     #=======

  4.     [root@xxx mysqlrp]# mkdir /tmp/test

  5.     #=======

  6.     #測(cè)試進(jìn)入臨時(shí)目錄,做數(shù)據(jù)目錄初始化

  7.     #=======

  8.     [root@xxx mysqlrp]# cd /tmp/test/

  9.     [root@xxx test]# /usr/local/mysqlrp/scripts/mysql_install_db --user=mysql &

  10.             [1] 36700

  11.             [root@xxx test]# FATAL ERROR: Could not find ./bin/my_print_defaults

  12.             If you compiled from source, you need to run 'make install' to

  13.             copy the software into the correct location ready for operation.

  14.             If you are using a binary release, you must either be at the top

  15.             level of the extracted archive, or pass the --basedir option

  16.             pointing to that location.

  17.             [1]+ Exit 1 /usr/local/mysqlrp/scripts/mysql_install_db --user=mysql

  18.     [root@xxx test]# /usr/local/mysqlrp/scripts/mysql_install_db --user=mysql --datadir=/data/mysql &

  19.             [1] 36704

  20.             [root@xxx test]# FATAL ERROR: Could not find ./bin/my_print_defaults

  21.             

  22.             If you compiled from source, you need to run 'make install' to

  23.             opy the software into the correct location ready for operation.

  24.             

  25.             If you are using a binary release, you must either be at the top

  26.             level of the extracted archive, or pass the --basedir option

  27.             pointing to that location.

  28.             

  29.            

  30.             [1]+ Exit 1 /usr/local/mysqlrp/scripts/mysql_install_db --user=mysql --datadir=/data/mysql

  31.     [root@xxx test]# /usr/local/mysqlrp/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysqlrp --datadir=/data/mysql &

  32.     #=======

  33.     #指定了根目錄后總算初始化成功

  34.     #=======

  35.     [root@xxx mysqlrp]# cp support-files/mysql.server /etc/init.d/mysqld

  36.     [root@xxx mysqlrp]# chown -R mysql.mysql /usr/local/mysql

  37.     [root@xxx mysqlrp]# chown -R mysql.mysql /data/mysql/

  38.     [root@xxx mysqlrp]# mkdir log

  39.     [root@xxx mysqlrp]# chown -R mysql.mysql log

  40.     [root@xxx mysqlrp]# ./bin/mysqld_safe --user=mysql &

  41.             [1] 37694

  42.             [root@xxx mysqlrp]# 151113 15:45:58 mysqld_safe Logging to '/data/mysql/zc-appname-ip-ip.err'.

  43.             151113 15:45:59 mysqld_safe Starting mysqld daemon with databases from /data/mysql

  44.             151113 15:45:59 mysqld_safe mysqld from pid file /data/mysql/zc-appname-ip-ip.pid ended

  45.             

  46.             [1]+ Done ./bin/mysqld_safe --user=mysql

  47.     [root@xxx mysqlrp]# ps -ef|grep mysql

  48.             root 37847 12729 0 15:46 pts/3 00:00:00 grep mysql

  49.     #=======

  50.     #試圖啟動(dòng),失敗

  51.     #=======

  52.     [root@xxx local]# mv mysqlrp/ mysql

  53.     [root@xxx mysqlrp]# chown -R mysql.mysql /usr/local/mysql

  54.     [root@xxx local]# mv mysql/ mysqlrp

  55.     [root@xxx local]# service mysqld start

  56.     Starting MySQL.The server quit without updating PID file (/data/mysql/zc-appname-ip-ip.pid). [FAILED]

  57.     #=======

  58.     #試圖啟動(dòng),失敗

  59.     #=======

  60.     [root@xxx local]# cd mysqlrp/

  61.     [root@xxx mysqlrp]# ./bin/mysqld

  62.     mysqld mysqld_multi mysqld_safe mysqldump mysqldumpslow

  63.     [root@xxx mysqlrp]# ./bin/mysqld_safe --user=mysql&

  64.     [1] 38052

  65.     [root@xxx mysqlrp]# 151113 15:49:31 mysqld_safe Logging to '/data/mysql/zc-appname-ip-ip.err'.

  66.     151113 15:49:31 mysqld_safe Starting mysqld daemon with databases from /data/mysql

  67.     151113 15:49:32 mysqld_safe mysqld from pid file /data/mysql/zc-appname-ip-ip.pid ended

  68.     [1]+ Done ./bin/mysqld_safe --user=mysql

  69.     [root@xxx mysqlrp]# ps -ef|grep mysql

  70.     root 38205 12729 0 15:49 pts/3 00:00:00 grep mysql

  71.     #=======

  72.     #試圖啟動(dòng),失敗

  73.     #=======

  74.     [root@xxx mysqlrp]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/ &

  75.     #=======

  76.     #初始化數(shù)據(jù)目錄成功

  77.     #=======

  78.     [root@xxx mysqlrp]# ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysqlrp/data/ &

  79.     #=======

  80.     #再次初始化數(shù)據(jù)目錄,成功

  81.     #=======

  82.     [root@xxx mysqlrp]# ./bin/mysqld_safe --user=mysql &

  83.     [1] 38312

  84.     [root@xxx mysqlrp]# 151113 15:56:03 mysqld_safe Logging to '/usr/local/mysqlrp/data/zc-appname-ip-ip.err'.

  85.     151113 15:56:03 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysqlrp/data

  86.     [root@xxx mysqlrp]# ps -ef|grep mysql

  87.     root 38312 12729 0 15:56 pts/3 00:00:00 /bin/sh ./bin/mysqld_safe --user=mysql

  88.     mysql 38441 38312 3 15:56 pts/3 00:00:00 /usr/local/mysqlrp/bin/mysqld --basedir=/usr/local/mysqlrp --datadir=/usr/local/mysqlrp/data --plugin-dir=/usr/local/mysqlrp/lib/plugin --user=mysql --log-error=/usr/local/mysqlrp/data/zc-appname-ip-ip.err --pid-file=/usr/local/mysqlrp/data/zc-appname-ip-ip.pid --socket=/tmp/mysql.sock

  89.     root 38465 12729 0 15:56 pts/3 00:00:00 grep mysql

  90.     #=======

  91.     #試圖啟動(dòng),成功

  92.     #=======

  93.     #=======

  94.     #實(shí)驗(yàn)2

  95.     #=======

  96.     [root@xxx mysqlrp]# 151113 15:56:43 mysqld_safe mysqld from pid file /usr/local/mysqlrp/data/zc-appname-ip-ip.pid ended

  97.     ps

  98.       PID TTY TIME CMD

  99.     12729 pts/3 00:00:00 bash

  100.     38471 pts/3 00:00:00 ps

  101.     [1]+ Done ./bin/mysqld_safe --user=mysql

  102.     [root@xxx mysqlrp]# ps -ef|grep mysql

  103.     root 38473 12729 0 15:56 pts/3 00:00:00 grep mysql

  104.     [root@xxx mysqlrp]# service mysqld start

  105.     Starting MySQL.The server quit without updating PID file (/[FAILED]ql/zc-appname-ip-ip.pid).

  106.     [root@xxx mysqlrp]#

  107.     [root@xxx local]# cp src/mysql-5.6.24/support-files/mysql.server /etc/init.d/mysqldcp: overwrite `/etc/init.d/mysqld'? y

  108.     [root@xxx local]# service mysqld start

  109.     /etc/init.d/mysqld: line 256: my_print_defaults: command not found

  110.     /etc/init.d/mysqld: line 276: cd: /usr/local/mysqlrp: No such file or directory

  111.     Starting MySQLCouldn't find MySQL server (/usr/local/mysqlr[FAILED]sqld_safe)

  112.     [root@xxx local]# mv mysql mysqlrp

  113.     [root@xxx local]# service mysqld start

  114.     Starting MySQL.The server quit without updating PID file (/[FAILED]ql/zc-appname-ip-ip.pid).

  115.     [root@xxx local]# vi /etc/my.cnf

  116.         datadir=xxxx

  117.     [root@xxx local]# service mysqld start

  118.     Starting MySQL.

  119.     [ OK ]

到此,相信大家對(duì)“MySQL源碼安裝的方法介紹”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

標(biāo)題名稱:MySQL源碼安裝的方法介紹-創(chuàng)新互聯(lián)
URL鏈接:http://jinyejixie.com/article12/cesdgc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、響應(yīng)式網(wǎng)站、網(wǎng)站排名App開發(fā)、手機(jī)網(wǎng)站建設(shè)Google

廣告

聲明:本網(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í)需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
北安市| 甘肃省| 南安市| 中宁县| 密云县| 台南县| 普兰县| 腾冲县| 四川省| 同仁县| 滨州市| 襄垣县| 海口市| 兴化市| 南宁市| 杭州市| 望城县| 思茅市| 石景山区| 丹巴县| 长海县| 陆川县| 临潭县| 铜山县| 昌乐县| 秦安县| 香格里拉县| 安丘市| 霍林郭勒市| 柳江县| 新安县| 蒙阴县| 萍乡市| 平顺县| 治多县| 永顺县| 郑州市| 双鸭山市| 长垣县| 山东| 绥德县|