标签:needed host div time 1.5 amp creat groupadd oba
mysql编译安装
一、安装cmake https://cmake.org/download/
/**************************************************************************/
yum -y install wget
wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
tar xf cmake-3.5.2.tar.gz
cd cmake-3.5.2
yum install -y make gcc gcc-c++ ncurses-devel
./bootstrap
gmake
gmake install
/**************************************************************************/
卸载相关
/**************************************************************************/
find / -name libboost_random.so* //查看相关的boost版本库
rpm -qa boost //查看安装版本
rpm -qa boost* //查看相关的boost库
rpm -e --nodeps boost-1.53.0-25.el7.x86_64 //卸载boost
rpm -e --nodeps \
-boost-thread-1.53.0-25.el7.x86_64 \
-boost-regex-1.53.0-25.el7.x86_64 \
-boost-wave-1.53.0-25.el7.x86_64 \
-boost-locale-1.53.0-25.el7.x86_64 \
-boost-python-1.53.0-25.el7.x86_64 \
-boost-atomic-1.53.0-25.el7.x86_64 \
-boost-random-1.53.0-25.el7.x86_64 \
-boost-iostreams-1.53.0-25.el7.x86_64 \
-boost-test-1.53.0-25.el7.x86_64 \
-boost-system-1.53.0-25.el7.x86_64 \
-boost-filesystem-1.53.0-25.el7.x86_64 \
-boost-date-time-1.53.0-25.el7.x86_64 \
-boost-graph-1.53.0-25.el7.x86_64 \
-boost-timer-1.53.0-25.el7.x86_64 \
-boost-serialization-1.53.0-25.el7.x86_64 \
-boost-context-1.53.0-25.el7.x86_64 \
-boost-program-options-1.53.0-25.el7.x86_64 \
-boost-signals-1.53.0-25.el7.x86_64 \
-boost-math-1.53.0-25.el7.x86_64 \
-boost-devel-1.53.0-25.el7.x86_64
rpm -qa | grep mysql
rpm -qa | grep mariadb
rpm -e --nodeps boost-system-1.53.0-25.el7.x86_64
rpm -e --nodeps boost-thread-1.53.0-25.el7.x86_64
rpm -e mariadb-libs-5.5.47-1.el7_2.x86_64
rpm -e --nodeps mariadb-libs-5.5.47-1.el7_2.x86_64
/**************************************************************************/
依赖包安装
/**************************************************************************/
1)gcc、make、cmake
2)mysql依赖包支持语法分析的bison库和终端类GUI支持ncurses
yum install bison* -y
yum install ncurses* -y
yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio libaio-devel perl-Data-Dumper net-tools
/**************************************************************************/
安装boost
/**************************************************************************/
wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
tar zvxf boost_1_59_0.tar.gz
cd boost_1_59_0
./bootstrap.sh --with-libraries=system,filesystem,log,thread --with-toolset=gcc
./b2 toolset=gcc cxxflags="-std=c++11"
./b2 install --prefix=/usr/local/boost
cd ..
/**************************************************************************/
./bootstrap.sh
./b2
sudo ./b2 install
#默认安装在/usr/local/lib目录下;头文件在/usr/local/include/boost目录下;install后面可以加参数 --prefix=/usr 来设置安装路径
#如果提示boost版本不对应则卸载boost安装对应版本boost
/**************************************************************************/
cmake安装mysql
/**************************************************************************/
cmake \
-DCMAKE_INSTALL_PREFIX=/var/lib/mysql \
-DMYSQL_DATADIR=/var/lib/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=/var/lib/mysql/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 \
-DWITH_BOOST=/root/boost_1_59_0
make && make install
/**************************************************************************/
编译出错,执行如下操作,然后重新配置。
/**************************************************************************/
make clean
rm -rf CMakeCache.txt
/**************************************************************************/
1、创建用户
/**************************************************************************/
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql
/**************************************************************************/
2、授权mysql数据库目录
/**************************************************************************/
chown -R mysql:mysql /var/lib/mysql
cd /var/lib/mysql
chown -R mysql .
chgrp -R mysql .
/**************************************************************************/
3、初始化mysql数据库
/**************************************************************************/
/var/lib/mysql/bin/mysqld \
--initialize \
--user=mysql \
--datadir=/var/lib/mysql/data
/**************************************************************************/
/home/data/mysql/bin/mysql_ssl_rsa_setup
chown -R root .
chown -R mysql data
/**************************************************************************/
添加相关服务/配置自启动
/**************************************************************************/
cp ./support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
chkconfig | grep mysql
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
/**************************************************************************/
拷贝相关服务到系统目录下
/**************************************************************************/
cd /home/data/mysql
cp usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
/**************************************************************************/
4、拷贝配置文件,修改配置文件
/**************************************************************************/
cp support-files/my-default.cnf /etc/my.cnf
[mysqld]
# These are commonly set, remove the # and set as required.
basedir = /var/lib/mysql
datadir = /var/lib/mysql /data
port = 3306
server_id = 2
socket =/var/lib/mysql/mysql.sock
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
/**************************************************************************/
拷贝启动文件并授权
/**************************************************************************/
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
/**************************************************************************/
启动数据库
/**************************************************************************/
/etc/init.d/mysqld start
/**************************************************************************/
登录数据库
/**************************************************************************/
/var/lib/mysql/bin/mysql -uroot -p
password:
/**************************************************************************/
/**************************************************************************/
firewall-cmd --zone=public --add-port=3306/tcp --permanent
yum -y install net-tools
/**************************************************************************/
修改root密码
/**************************************************************************/
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘chenyuegu@mysql‘
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.12.146‘;
FLUSH PRIVILEGES;
CREATE USER ‘center‘@‘%‘ IDENTIFIED BY ‘sdflc@mysql‘;
GRANT select ON *.* TO ‘center‘@‘%‘;
yum -y install net-tools
firewall-cmd --zone=public --add-port=8066/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl restart firewalld.service
/**************************************************************************/
wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
tar xf cmake-3.5.2.tar.gz
cd cmake-3.5.2
yum install -y make gcc gcc-c++ ncurses-devel
./bootstrap
gmake
gmake install
cd..
tar xvf boost_1_59_0.tar.gz
cd boost_1_59_0
./bootstrap.sh --with-libraries=system,filesystem,log,thread --with-toolset=gcc
./b2 toolset=gcc cxxflags="-std=c++11"5 ./b2 install --prefix=/usr/local/boost
/**************************************************************************/
以上为个人笔记总结,现已真实安装部署,转载请联系作者
MYSQL5.7.16 编译安装
标签:needed host div time 1.5 amp creat groupadd oba
原文地址:http://www.cnblogs.com/chenyuegu/p/6147956.html