centos 安装mysql

安装基本依赖包,先用yum安装cmakeautomake 、autoconf ,另MySQL 5.5.x需要最少安装的包有:bison,gcc、gcc-c++ncurses-devel

[root@localhost ~]# yum install cmake make -y
[root@localhost ~]# yum install gcc gcc-c++ autoconf  bison automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* -y
[root@localhost ~]# cp /root/mysql-5.5.28.tar.gz /usr/software/
[root@localhost ~]# cd /usr/software
开始编译安装
[root@localhost ~]# tar -zxvf mysql-5.5.28.tar.gz
[root@localhost ~]# cd mysql-5.5.28
[root@localhost ~]#  cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=utf8,gbk,gb2312 \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_USER=mysql \
-DSYSCONFDIR=/etc/my.cnf \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0

 

[root@localhost ~]# make && make install
 
 
 
chmod 755 scripts/mysql_install_db
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld

 

你可能感兴趣的:(centos)