標籤:blog http os io 檔案 資料 ar 代碼
1.上傳mysql-5.5.21.tar.gz和cmake-2.8.3.tar.gz到/usr/local檔案夾下。2.CentOS安裝g++和ncurses-devel
[[email protected] local]# yum -y install gcc-c++
[[email protected] local]# yum -y install ncurses-devel
3.cmake的安裝
[[email protected]]# tar -zxv -f cmake-2.8.10.2.tar.gz // 解壓壓縮包
[[email protected] local]# cd cmake-2.8.10.2
[[email protected] cmake-2.8.10.2]# ./configure
[[email protected] cmake-2.8.10.2]# make
[[email protected] cmake-2.8.10.2]# make install
4.將cmake永久加入系統內容變數
用vi在檔案/etc/profile檔案中增加變數,使其永久有效,
[[email protected] local]# vi /etc/profile (不會用vi命令的,可以找到/etc/profile 對應檔案,對檔案進行編輯)
在檔案末尾追加以下兩行代碼:
PATH=/usr/local/cmake-2.8.10.2/bin:$PATH
export PATH
執行以下代碼使剛才的修改生效:
[[email protected] local]# source /etc/profile
用 export 命令查看PATH值
[[email protected] local]# echo $PATH
5.建立mysql的安裝目錄及資料庫存放目錄
[[email protected]]# mkdir -p /usr/local/mysql
[[email protected]]# mkdir -p /usr/local/mysql/data //存放資料庫
6.建立mysql使用者及使用者組
[[email protected]] groupadd mysql
[[email protected]] useradd -r -g mysql mysql
7.編譯安裝mysql
[[email protected] local]# tar -zxv -f mysql-5.5.21.tar.gz //解壓
[[email protected] local]# cd mysql-5.5.21
[[email protected] mysql-5.5.21]#
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306
[[email protected] mysql-5.5.21]# make
[[email protected] mysql-5.5.21]# make install
8.檢驗是否安裝成功
[[email protected] mysql-5.5.29]# cd /usr/local/mysql/
[[email protected] mysql]# ls
bin COPYING data docs include INSTALL-BINARY lib man mysql-test README scripts share sql-bench support-files
有bin等以上檔案的話,恭喜你已經成功安裝了mysql
本文摘自:http://www.cnblogs.com/zhoulf/archive/2013/01/25/zhoulf.html