编译安装mysql

1.配置环境

# yum -y install gcc gcc-c++ ncurses-devel openssl openssl-devel libtool*


2.安装mysql

# tar xvf mysql-5.1.50.tar.gz

# cd mysql-5.1.50

# ./configure  ‘--prefix=/usr/local/mysql-5.1‘ ‘--localstatedir=/data‘ ‘--with-unix-socket-path=/usr/local/mysql-5.1/mysql.sock‘ ‘--with-charset=utf8‘ ‘--with-extra-charsets=complex‘ ‘--with-pthread‘ ‘--enable-thread-safe-client‘ ‘--with-ssl‘ ‘--with-client-ldflags=-all-static‘ ‘--with-mysqld-ldflags=-all-static‘ ‘--with-plugins=partition,federated,ndbcluster,innobase,csv,blackhole,myisam,innodb_plugin,heap,archive‘ ‘--enable-shared‘ ‘--enable-assembler‘

# make && make install


3.初始化

# groupadd  mysql

# useradd  -g mysql -s /sbin/nologin -M mysql

# mkdir /data

# mkdir /usr/local/mysql-5.1

# chown -R mysql:mysql /usr/local/mysql-5.1

# chown -R mysql:mysql /data

# /usr/local/mysql-5.1/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.1--datadir=/data

# cp /usr/local/mysql-5.1/share/mysql/mysql.server /etc/init.d/mysqld

# chmod 755 /etc/init.d/mysqld

# vim /etc/init.d/mysqld

basedir=/usr/local/mysql-5.1

datadir=/data

注意:/usr/local/mysql-5.1/etc/my.cnf

         [mysqld]
         datadir=/data
         basedir = /usr/local/mysql-5.1

         socket = /usr/local/mysql-5.1/mysql.sock


4.设置环境变量

# vim /etc/profile
MYSQL=/usr/local/services/mysql/bin
PATH=$PATH:$MYSQL
export PATH
# source /etc/profile


5.启动服务器

# /etc/init.d/mysqld start


编译安装mysql,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。