mysql5.7编译安装
下载软件
- mysql源码,
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.27.tar.gz
- 下载boost源码,
https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
安装依赖
yum install make cmake gcc gcc-g++ ncurses ncurses-devel bison bison-devel libgcrypt perl
编译
groupadd mysql
useradd -r -g mysql -s /bin/false -M mysq
tar zxf mysql-5.7.27.tar.gz
cd mysql-5.7.27/
mkdir bld
cd bld/
cmake ..
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_BOOST=/usr/local/boost_1_59_0 -DWITH-SSL -DWITH-DEBUG=1
make
make install
#make install DESTDIR="/opt/mysql"
#生成可以在任意位置安装的安装包文件
make package
chown mysql:mysql /usr/local/mysql
chmod 750 /usr/local/mysql
echo "export PATH=$PATH:/usr/local/mysql/bin">>/etc/profile
source /etc/profile
初始化数据
mysqld --defaults-file=/etc/my.cnf --initialize --user='mysql' --log_error_verbosity --explicit_defaults_for_timestamp
启动
mysql_safe --default-file=/etc/my.cnf --user=mysql &
#充值初始化密码,默认密码策略 字母大小写、数字,大于等于8位,第二次修改就没有限制了
ALTER USER USER() IDENTIFIED BY '123456';
添加系统服务
cp ./bld/support-files/mysql.server /etc/init.d/mysqld
service mysql start|stop