centos7 mysql 5.7.24 源码编译

下载源码包 mysql-5.7.24    boost_1_59_0.tar.gz
部署:
# root @ k8s-mysql02 in ~ yum install -y cmake bison bison-devel libaio-devel gcc gcc-c++ git  ncurses-devel
# root @ k8s-mysql02 in ~ cd /usr/local/src
# root @ k8s-mysql02 in ~tar -xf mysql-5.7.24.tar.gz 
# root @ k8s-mysql02 in ~mkdir /usr/local/src/mysql-5.7.24/boost
# root @ k8s-mysql02 in ~ tar -xf boost_1_59_0.tar.gz  -C  /usr/local/src/mysql-5.7.24/boost/
# root @ k8s-mysql02 in ~groupadd mysql
# root @ k8s-mysql02 in ~useradd -M -s /sbin/nologin -r -g mysql mysql
# root @ k8s-mysql02 in ~ mkdir -p /data/mysql/data
# root @ k8s-mysql02 in ~ cd /usr/local/src/mysql
# root @ k8s-mysql02 in ~  cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/data/mysql/data/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/src/mysql-5.7.24/boost/boost_1_59_0

# root @ k8s-mysql02 in ~  make && make install
# root @ k8s-mysql02 in ~ chown  mysql:mysql  /usr/local/mysql/ -R

# root @ k8s-mysql02 in ~ cp /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysqld

# root @ k8s-mysql02 in ~ chmod  +x /etc/init.d/mysqld
# root @ k8s-mysql02 in ~  vim  /etc/init.d/mysqld
修改 basedir    basedir=/usr/local/mysql
修改 datadir    datadir=/data/mysql/data
# root @ k8s-mysql02 in ~ vim  /etc/profile
增加环境变量
export PATH=/usr/local/mysql/bin:$PATH
# root @ k8s-mysql02 in ~ source  /etc/profile
# root @ k8s-mysql02 in ~ /usr/local/mysql/bin/mysqld    --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data/
记住初始化密码

# cat /etc/my.cnf [mysqld] basedir = /usr/local/mysql datadir = /data/mysql/data socket = /data/mysql/data/mysql.sock user = mysql tmpdir = /data/mysql/data symbolic-links=0 log-bin = mysql-bin server-id = 00823401 [mysqld_safe] log-error = /data/mysql/data/error.log pid-file = /data/mysql/data/mysql.pid # root @ k8s-mysql02 in ~ /etc/init.d/mysqld start 注: 启动报错 mkdir /var/lib/mysql chmod 777 /var/lib/mysql # root @ k8s-mysql02 in ~ mysql -u root -p (需要修改密码) mysql> alter user 'root'@'localhost' identified by '1234'; mysql> update user set authentication_string = password('1234') where user = 'root';
posted @ 2019-08-23 13:29  lixinliang  阅读(407)  评论(0编辑  收藏  举报