Centos7.5安装mysql5.7.24二进制包方式部署
程序员文章站
2023-11-27 23:41:10
一、环境准备:
操作系统:centos linux release 7.5.1804 (core)
mysql版本:mysql-5.7.24-linux-glibc2....
一、环境准备:
操作系统:centos linux release 7.5.1804 (core)
mysql版本:mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
ip:172.16.8.247
二、mysql5.7二进制安装
1、安装依赖包
yum -y install libaio
2、安装mysql软件
下载软件包:
https://cdn.mysql.com//downloads/mysql-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
tar -xvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -c ../ cd .. mv mysql-5.7.24-linux-glibc2.12-x86_64/ mysql5.7 useradd -s /sbin/nologin -m mysql mkdir -p /app/mysql5.7/{etc,logs,tmp}
3、初始化数据
bin/mysqld --initialize --basedir=/app/mysql5.7/ --datadir=/app/mysql5.7/data --user=mysql # bin/mysqld --initialize --basedir=/app/mysql5.7/ --datadir=/app/mysql5.7/data --user=mysql 2018-11-25t03:03:16.299117z 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-11-25t03:03:16.946059z 0 [warning] innodb: new log files created, lsn=45790 2018-11-25t03:03:17.033699z 0 [warning] innodb: creating foreign key constraint system tables. 2018-11-25t03:03:17.089657z 0 [warning] no existing uuid has been found, so we assume that this is the first time that this server has been started. generating a new uuid: a7fef663-f05e-11e8-b1f5-08002728f0e4. 2018-11-25t03:03:17.090377z 0 [warning] gtid table is not ready to be used. table 'mysql.gtid_executed' cannot be opened. 2018-11-25t03:03:17.090784z 1 [note] a temporary password is generated for root@localhost: m:fw/7on%>bh
4、修改配置文件
chown -r mysql . vim /app/mysql5.7/etc/my.cnf [mysqld] daemonize = on user = mysql port = 3306 basedir = /app/mysql5.7 datadir = /app/mysql5.7/data socket = /tmp/mysql.sock bind-address = 0.0.0.0 pid-file = /app/mysql5.7/tmp/mysqld.pid character-set-server = utf8 collation-server = utf8_general_ci max_connections = 2408 log-error = /app/mysql5.7/logs/mysqld.log
5、systemd启动mysql服务
vim /lib/systemd/system/mysqld.service [unit] description=mysql server documentation=man:mysqld(8) documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html after=network.target after=syslog.target [install] wantedby=multi-user.target [service] user=mysql group=mysql type=forking timeoutsec=0 permissionsstartonly=true execstart=/app/mysql5.7/bin/mysqld --defaults-file=/app/mysql5.7/etc/my.cnf limitnofile = 5000 restart=on-failure restartpreventexitstartus=1 privatetmp=false
6、启动服务
systemctl restart mysqld systemctl enable mysqld
7、修改mysql root密码
vim /etc/profile export path=$path:/app/mysql5.7/bin source /etc/profile mysql -uroot -p alter user 'root'@'localhost' identified by 'devops@2018';
总结
以上所述是小编给大家介绍的centos7.5安装mysql5.7.24二进制包方式部署,希望对大家有所帮助
下一篇: PHP信号量基本用法实例详解