CentOS 6.5版本
Linux vitus.feng 2.6.32-642.11.1.el6.x86_64 #1 SMP Fri Nov 18 19:25:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
mysql5.5版本
Server version: 5.5.54-log Source distribution
下载地址:https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.54.tar.gz
安装目录 /usr/local/mysql
数据目录 /usr/local/mysql/data
总结:首次安装时去官网下载的源码包版本不对,导致后面安装报错毫无头绪
安装步骤:
1.准备工作
a. 安装库
yum -y install gcc*
b.安装cmake编译工具
cd /usr/local/src
#下载cmake-2.8.7.tar.gz
wget http://............................(51cto或自行百度下载)
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
#安装cmake
./configure
make
make install
2. 官网下载 MYSQL5.5版本 linux下源码包
groupadd mysql
useradd -g mysql mysql
tar zxvf mysql-5.5.54.tar.gz
cd mysql-5.5.54
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1
make
make install
cd /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql -datadir=/mysql/data
#此处如不指定datadir,到启动时会报错
chown -R root .
chown -R mysql data
cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe --user=mysql &
# Next command is optional
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
/etc/init.d/mysqld start
安装完成,使用/usr/local/mysql/bin/mysql 登录测试
原文:http://vitus.blog.51cto.com/6450023/1893259