mysql5.5编译安装及配置

环境(centos5 64)

安装所需要系统库相关库文件 
gcc gcc-c gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* 


yum -y install gcc gcc-c autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

 创建mysql安装目录  

[root@localhost ~]# mkdir -p /pub/local/mysql/

 创建数据存放目录
[root@localhost ~]# mkdir -p /data/mysql/

 

下载所需的软件
wget  http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
wget  http://mirror.csclub.uwaterloo.ca/mysql/Downloads/MySQL-5.5/mysql-5.5.21.tar.gz   (地址已经失效、自行谷歌)

安装:

tar   zxvf   cmake-2.8.4.tar.gz  解压

cd  cmake-2.8.4

./configure  &&make &&make install   安装


tar   zxvf  mysql-5.5.21.tar.gz  解压

 

创建mysql用户、以及用户组
groupadd   mysql
useradd   -g  mysql   mysql

 


cd   mysql-5.5.21 切换目录:

cmake -DCMAKE_INSTALL_PREFIX=/pub/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/data/mysql \
-DMYSQL_TCP_PORT=3306 \
-DSYSCONFDIR=/etc \
-DINSTALL_SHAREDIR=share

make  && make install  安装...

 

复制配置文件
[root@localhost mysql-5.5.21]# cp support-files/my-medium.cnf /etc/my.cnf

 

cp support-files/mysql.server /etc/init.d/mysqld  设置启动快捷方式
chown  mysql.mysql   /etc/my.cnf   权限设置
chmod  755 /etc/init.d/mysqld   

 

scripts/mysql_install_db --user=mysql --basedir=/pub/local/mysql --datadir=/data/mysql/   赋给文件执行权限

 

启动mysql服务
[root@localhost mysql-5.5.21]# /etc/init.d/mysqld start //服务器端开关

 

建一个一个软连接:

ln -s /usr/local/mysql/bin/mysql /usr/bin

转载于:https://www.cnblogs.com/toxiaonan/archive/2012/11/30/2796589.html

你可能感兴趣的:(mysql5.5编译安装及配置)