1,增長mysql用戶mysql
groupadd mysqlnginx
useradd -g mysql mysql -s /usr/sbin/nologinsql
2,建立mysql安裝目錄數據庫
mkdir /usr/local/mysqlapp
3,進入msyql源碼包目錄socket
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql && make && make installspa
編譯安裝失敗code
Curses library not found. Please install appropriate packageserver
解決辦法blog
rm -f CMakeCache.txt
yum install ncurses-devel
從新編譯
4,初始化mysql數據庫
進入mysql安裝目錄採用相對路徑的方式初始化mysql數據庫
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
5,cp配置文件
cp support-files/my-default.cnf /usr/local/mysql/my.cnf
6,設置下my.cnf文件,以防止默認的mysql環境引發的衝突
[mysqld] basedir = /usr/local/mysql datadir = /usr/local/mysql/data log-error = /usr/local/mysql/mysql_error.log pid-file = /usr/local/mysql/mysql.pid user = mysql
tmpdir = /tmp
socket = /var/lib/mysql/mysql.sock
7,賦予myql目錄mysql用戶權限
chown -R mysql:mysql /usr/local/mysql
8,啓動mysql
bin/mysqld_safe --user=mysql &
9,添加mysql爲系統服務
cp ./mysql.server /etc/init.d/mysqld
chkconfig mysqld on
chkconfig --list nginx
end!