CentOS源码安装MySQL5.1.41

 

#安装需要的库
yum -y install ncurses ncurses-devel

#创建MySQL用户及用户组
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql

cp /home/root/mysql-5.1.41.tar.gz /usr/local/src
cd /usr/local/src
tar zxvf mysql-5.1.41.tar.gz
chown -R mysql:mysql mysql-5.1.41
cd mysql-5.1.41
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--with-unix-socket-path=/usr/local/mysql/data/mysql.sock \
--with-plugins=innobase,partition,myisam,heap \
--enable-assembler \
--with-charset=utf8 \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-static=yes \
--with-big-tables

make
make install

 

#根据应用程序的负载选择对应的配置文件
mkdir /usr/local/mysql/etc
cp /usr/local/mysql/share/mysql/my-medium.cnf /usr/local/mysql/etc/my.cnf
vi /usr/local/mysql/etc/my.cnf

#在[mysqld]中添加:
pid-file = /usr/local/mysql/etc/mysql.pid
datadir = /usr/local/mysql/data
#设置pid位置及数据存放位

chown -R mysql:mysql /usr/local/mysql
 
#安装系统表
/usr/local/mysql/bin/mysql_install_db \
--basedir=/usr/local/mysql \
--defaults-file=/usr/local/mysql/etc/my.cnf \
--skip-external-locking \
--user=mysql

#启动MySQL
/usr/local/mysql/bin/mysqld_safe \
--defaults-file=/usr/local/mysql/etc/my.cnf \
--user=mysql &
  
#将MySQL添加到系统服务
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld

你可能感兴趣的:(thread,mysql,socket,centos,unix)