一、工具
cmake-3.0.1.tar.gz mysql-5.5.35.tar.gz
二、安装部署
1.安装cmake
tar -zxvf cmake-3.0.1.tar.gz
cd cmake-3.0.1
./configure
make && make install
2.新建mysql用户
groupadd mysql
useradd -r -g mysql mysql
mkdir -p /usr/local/mysql //mysql安装目录
mkdir -p /appmysql/ //数据库文件目录
3.安装mysql
tar -zxvf mysql-5.5.35.tar.gz
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/app/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DSYSCONFDIR=/etc -DMYSQL_USER=mysql
make && make install
修改目录权限
chown -R mysql:mysql /app/mysql
chown -R root:mysql /usr/local/mysql
4.配置启动
拷贝配置文件
cd /usr/local/mysql/support-files
cp my-large.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysqld
初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/app/mysql/ --basedir=/usr/local/mysql
开机启动mysql
编辑/etc/init.d/mysqld,设置以下变量的值:
Basedir = /usr/local/mysql
Datadir = /usr/local/mysql/data
加入开机自启动
chkconfig --add mysqld
chkconfig --level 345 mysqld on
启动mysql
service mysqld start
原文地址:http://961911.blog.51cto.com/951911/1550566