MySQL 5.5單實例 編譯安裝
1、建立MySQL賬號
首先以root登錄到Linux,然後執行如下命令創建MySQL組及用戶
[[email protected] home]# groupadd mysql [[email protected] home]# useradd -s /sbin/nologin -g mysql -M mysql [[email protected] home]# tail -1 /etc/passwd feitian:x:811:811::/home/mysql:/sbin/nologin(/sbin/nologin表示不能登錄) -s/sbin/nologin表示禁止登錄 -gmysql指定屬於mysql組 -M表示不創建家目錄。 [[email protected]
2、編譯安裝MySQL
2.1獲得MySQL軟件
1》通過rz上傳
2》wgte 在搜狐的鏡像站點中下載 http://mirrors.sohu.com/mysql/MySQL-5.7/
2.2編譯[[email protected] tools]# tar zxf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
./configure \ --prefix=/usr/local/mysql \ #安裝路徑 --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \ #指定socket文件存放 --localstatedir=/usr/local/mysql/data \ #MySQL數據文件存放位置 --enable-assembler \ #允許使用匯編模式 --enable-thread-safe-client --with-mysqld-user=mysql \ #指定MySQL運行的系統用戶 --with-big-tables--without-debug \ #使用非debug --with-pthread \ #強制使用pthread線程序庫編譯 --enable-assembler --with-extra-charsets=complex --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase,partition --enable-thread-safe-client \ #使用線程的方式編譯客戶端 --with-client-ldflags=-all-static \ #服務端使用靜態庫 --with-mysqld-ldflags=-all-static #客戶端使用靜態庫 #等待完成之後make && make install
3、獲取MySQL配置文件
[[email protected] mysql-5.1.72]# ll support-files/*.cnf -rw-r--r-- 1 root root 4714 May 11 08:53 support-files/my-huge.cnf -rw-r--r-- 1 root root 19763 May 11 08:53 support-files/my-innodb-heavy-4G.cnf -rw-r--r-- 1 root root 4688 May 11 08:53 support-files/my-large.cnf -rw-r--r-- 1 root root 4699 May 11 08:53 support-files/my-medium.cnf -rw-r--r-- 1 root root 2467 May 11 08:53 support-files/my-small.cnf #這裏有大中小和超大三個配置文件,這裏是試驗環境我們最好選最小的配置文件 [[email protected]