二进制部署MySQL(运维技术交流群:926402931,欢迎大家一起来交流。)

1.MySQL安装前准备

1.1.安装依赖包
yum  install  -y  ncurses-devel libaio-devel
1.2.安装cmake
yum install cmake -y
1.3.创建用户
useradd -s /sbin/nologin -M mysql
id mysql

2.MySQL下载安装

2.1.创建软件下载目录
mkdir -p /server/tools
cd /server/tools/
2.2.下载并上传到/server/tools
https://downloads.mysql.com/archives/community/
2.3.解压
cd /server/tools
tar xf mysql-5.6.36.tar.gz
2.4.安装
cd mysql-5.6.36

cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36 -DMYSQL_DATADIR=/application/mysql-5.6.36/data -DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITH_ZLIB=bundled -DWITH_SSL=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_EMBEDDED_SERVER=1 -DENABLE_DOWNLOADS=1 -DWITH_DEBUG=0

make && make install

3.配置并启动

3.1.创建软链接
ln -s /application/mysql-5.6.36/ /application/mysql
3.2.拷贝配置文件到/etc
cd /application/mysql
cp support-files/my*.cnf /etc/my.cnf
3.3.初始化数据库
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
3.4.创建目录并授权
mkdir -p /application/mysql/tmp
chown -R mysql.mysql /application/mysql/
3.5.复制启动脚本到/etc/init.d/mysqld
cp support-files/mysql.server /etc/init.d/mysqld
3.6.启动数据库
/etc/init.d/mysqld start
netstat -lntup|grep 330
3.7.配置环境变量
echo ‘PATH=/application/mysql/bin/:$PATH‘ >>/etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
mysql

二进制部署MySQL(运维技术交流群:926402931,欢迎大家一起来交流。)

上一篇:python数据库的封装


下一篇:mysql force index 优化案例