Linux MySQL 5.1源碼安裝

安裝必備的軟件
yum install ncurses-devel -y
yum install pcre pcre-devel -y
yum install gcc* -y
 
解壓縮
tar -zxvf mysql-5.1.72.tar.gz 
 
 
建立目錄
mkdir /application/mysql5.1.72/{data,tmp} -p
chown -R mysql:mysql /application
 
 
編譯MySQL
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static 
#--with-plugin-PLUGIN \
 
 
make && make install
 
 
 
建立軟鏈接
ln -s /application/mysql5.1.72/ /application/mysql
 
 
cp support-files/my-small.cnf /etc/my.cnf
 
 
建立mysql用戶
groupadd mysql
useradd -g mysql mysql
echo "oracle" |passwd --stdin mysql
 
 
建立數據文件目錄
mkdir /application/mysql/data -p
 
chown -R mysql:mysql /application/mysql
 
初始化過程
/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
 
若是沒有出現錯誤(出現Waring能夠),而且出現兩個OK,說明初始化成功。
 
 
添加/application/mysql/bin到環境變量
export PATH=/application/mysql/bin:$PATH
相關文章
相關標籤/搜索