二进制部署MySQL5.7
目录
- 1.下载MySQL5.7
- 2.上传压缩包,并解压
- 3.配置并启动
- 3.1.制作软链接
- 3.2.配置my.cnf
- 3.3.创建关键目录并设置权限
- 3.4.初始化数据库
- 3.5.复制启动脚本到/etc/init.d/mysqld
- 3.6.启动数据库
- 3.7.配置环境变量
1.下载MySQL5.7
https://downloads.mysql.com/archives/community/
2.上传压缩包,并解压
mkdir -p /server/toolscd /server/tools/
tar xf mysql-5.7.20.tar.gz -C /application
3.配置并启动
3.1.制作软链接
ln -s /application/mysql-5.7.20/ /application/mysql
3.2.配置my.cnf
vi /etc/my.cnfbasedir=/application/mysql
datadir=/application/mysql/data
socket=/application/mysql/tmp/mysql.sock
port=3306
server_id=10
log-error=/var/log/mysql.log
log-bin=/data/binlog/my-bin
sync_binlog=1
binlog_format=row
skip_name_resolve
default_storage_engine=innodb
character-set-server=utf8
autocommit=0
[mysql]
socket=/application/mysql/tmp/mysql.sock
default-character-set=utf8
3.3.创建关键目录并设置权限
mkdir -p /application/mysql/tmp /application/mysql/data /data/binlogchown -R mysql.mysql /application/mysql/ /data/binlog
3.4.初始化数据库
/application/mysql/bin/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
3.5.复制启动脚本到/etc/init.d/mysqld
cd /application/mysqlcp support-files/mysql.server /etc/init.d/mysqld
3.6.启动数据库
/etc/init.d/mysqld startnetstat -lntup|grep 330
3.7.配置环境变量
echo "PATH=/application/mysql/bin/:$PATH" >>/etc/profiletail -1 /etc/profile
source /etc/profile
以上是 二进制部署MySQL5.7 的全部内容, 来源链接: utcz.com/z/516005.html