cmake 安装mysql
1,增加mysql用户
groupadd mysql
useradd -g mysql mysql -s /usr/sbin/nologin
2,创建mysql安装目录
mkdir /usr/local/mysql
3,进入msyql源码包目录
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql && make && make install
编译安装失败
Curses library not found. Please install appropriate package
解决办法
rm -f CMakeCache.txt
yum install ncurses-devel
重新编译
4,初始化mysql数据库
进入mysql安装目录采用相对路径的方式初始化mysql数据库
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
5,cp配置文件
cp support-files/my-default.cnf /usr/local/mysql/my.cnf
6,设置下my.cnf文件,以防止默认的mysql环境引起的冲突
[mysqld] basedir = /usr/local/mysql datadir = /usr/local/mysql/data log-error = /usr/local/mysql/mysql_error.log pid-file = /usr/local/mysql/mysql.pid user = mysql
tmpdir = /tmp
socket = /var/lib/mysql/mysql.sock
7,赋予myql目录mysql用户权限
chown -R mysql:mysql /usr/local/mysql
8,启动mysql
bin/mysqld_safe --user=mysql &
9,添加mysql为系统服务
cp ./mysql.server /etc/init.d/mysqld
chkconfig mysqld on
chkconfig --list nginx
end!