一?MYSQL的编译安装
(1) 准备工作
1) 卸载rpm方式安装的mysql
Rpm –q mysql-server mysql
Rpm–ivh/run/media/root/CentOS\7\x86_64/Packages/ncurses-devel-5.9—13.20130511.e17.x86_64.rpm
2) 安装cmake包
Tar zxvf cmake-2.8.6.tar.gz
Cd cmake-2.8.6
./configure
Gmake && gmake install
(2) 源码编译及安装
1) 创建运行用户
Groupadd mysql
Useradd –M –s /sbin/nologin mysql –g mysql
2) 解包
Tar zxvf mysql-5.6.36.tar.gz –C /usr/src
Cd /usr/src/mysql-5.6.36/
3) 配置
Cmake
-DCMAKE_INSATLL_PREFIX=/usr/local/mysql
-DSYSCONFDIR=/etc
-DDEFAULT_CHARSET=utf8
-DDEFAULT|_COLLATION=utf8_general_ci
-DWITH_EXTPA_CHARSETS=all
4) 编译并安装
Make && make install
(3) 安装后记得其他调整
1) 对数据库目录进行权限设置
Chown –R mysql:mysql /usr/local/mysql
2) 建立配置文件
Cp support-files/my-default.cnf /etc/my.cnf
3) 初始化数据库
/usr/local/mysql/scripts/mysql_install_db
--user=mysql
--basedir=/usr/loca;/mysql
--datadir=/usr/local/mysql/data/
4) 设置环境变量
Echo “PATH=$PATH:/usr/locall/mysql/bin” >>/etc/profile
. /etc/profile
(4) 添加系统服务
Cp support-files/mysql.service /usr/local/mysql/bin/mysqld.sh
Chmod +x /usr/local/mysql/bin/mysqld.sh
Vim /usr/lib/system/system/mysqld.service
[Unit]
Descripton=MySQL Server
After=network.target
[Service]
User=mysql
Group=mysql
Type=forking
PIEFile=/usr/local/mysql/data/www.pid
ExecStart=/usr/local/mysql/bin/mysqld.sh start
ExecStop=/usr/local/mysql/bin/mysqld.sh stop
[Install]
WantedBy=multi-user.target
Systemctl start mysqld
Systemctl enable mysqld
原文:http://blog.51cto.com/13468179/2314788