mysql 源代码编译安装

操作系统补丁:
#yum install -y gcc 
#yum install -y gcc-c++
#yum install -y ncurses-devel
#yum install -y perl
#yum install -y bison  
#yum install -y autoconf 
#yum install -y automake 
#yum install -y libtool 
#yum install -y libgcrypt

创建用户:
#groupadd -r mysql
#useradd -r -g mysql -s /sbin/nologin  mysql    

cmake编译安装:
#tar -zxvf cmake-2.8.10.2.tar.gz  
#./bootstrap
#make &&  make install
#cmake -version    验证版本信息

创建目录:
安装目录   mkdir -p /usr/local/mysql
数据目录   mkdir -p /opt/mysql/data
并修改属主和权限

mysql的编译安装:
#tar -xvf mysql-boost-5.7.20.tar.gz
# cmake .   -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/opt/mysql/data  -DDOWNLOAD_BOOST=1  -DWITH_BOOST=/sft/mysql-5.7.20/boost  -DSYSCONFDIR=/etc  -DWITH_INNOBASE_STORAGE_ENGINE=1  -DWITH_PARTITION_STORAGE_ENGINE=1  -DWITH_FEDERATED_STORAGE_ENGINE=1  -DWITH_BLACKHOLE_STORAGE_ENGINE=1  -DWITH_MYISAM_STORAGE_ENGINE=1  -DENABLED_LOCAL_INFILE=1  -DENABLE_DTRACE=0  -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci  -DWITH_EMBEDDED_SERVER=1  
# make && make install
#
# 初始化数据库
#编辑/etc/my.cnf 
[mysqld]
datadir=/opt/mysql/data
socket=/opt/mysql/data/mysql.sock
user=mysql
[mysqld_safe]
log-error=/opt/mysql/data/mysqlS.err
pid-file=/opt/mysql/data/mysqld.pid
[client]
socket =/opt/mysql/data/mysql.sock
#cd /usr/local/mysql/bin
#/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/opt/mysql/data
#/usr/local/mysql/bin/mysqld_safe 
新开另外一个窗口:
# mysql -uroot -p 
>alter user 'root'@'localhost' identified by 'root'; 

配置启动服务:
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld  
# service  mysqld stop
# service  mysqld start

安装SSL
# cd /usr/local/mysql/bin
#./mysql_ssl_rsa_setup   

你可能感兴趣的:(mysql技术)