CentOS6.3源碼安裝mysql5.5.28

來源:互聯網
上載者:User

全新以最小化包安裝了64位的CentOS6.3系統,作為本地的Web伺服器使用,現記錄全過程
第六步,安裝mysql5.5資料庫v5.5.28

mysql從5.5版本開始,不再使用./configure編譯,而是使用cmake編譯器,具體的cmake編譯參數可以參考mysql官網文檔(※ 非常重要)
http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

mysql-5.5.28.tar.gz源碼包:
http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz

我的mysql目錄配置如下:
安裝路徑:/usr/local/mysql
資料庫路徑:/data/mysql
源碼包存放位置:/usr/software

準備工作:安裝基本依賴包,先用yum安裝cmake、automake 、autoconf ,另MySQL 5.5.x需要最少安裝的包有:bison,gcc、gcc-c++、ncurses-devel
[root@localhost ~]# yum install cmake make -y
[root@localhost ~]# yum install gcc gcc-c++ autoconf bison automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* -y
[root@localhost ~]# cp /root/mysql-5.5.28.tar.gz /usr/software/
[root@localhost ~]# cd /usr/software
開始編譯安裝
[root@localhost ~]# tar -zxvf mysql-5.5.28.tar.gz
[root@localhost ~]# cd mysql-5.5.28
[root@localhost ~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
        -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
        -DDEFAULT_CHARSET=utf8 \
        -DDEFAULT_COLLATION=utf8_general_ci \
        -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
        -DWITH_INNOBASE_STORAGE_ENGINE=1 \
        -DWITH_READLINE=1 \
        -DENABLED_LOCAL_INFILE=1 \
        -DMYSQL_DATADIR=/data/mysql/ \
        -DMYSQL_USER=mysql \
        -DMYSQL_TCP_PORT=3306
[root@localhost ~]# make && make install

mysql官網英文文檔簡單翻譯說明一下
The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always compiled into the server) and need not be installed explicitly.(說明:mysql預設支援的資料庫引擎有MyISAM, MERGE, MEMORY, CSV,無需在編譯時間再聲明)
所以上面的編譯條件省掉了如下兩行
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
但INNODB一定要聲明式安裝,所以多了這一行
-DWITH_INNOBASE_STORAGE_ENGINE=1 \

查看mysql.mysql的使用者及組是否存在

  • 1
  • 2
  • 下一頁

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.