centos一键安装mysql_centos7.6一键式安装mysql5.7.21

执行./mysql.sh内容:

wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz

mkdir -p /home/data/server/

rm -rf /etc/my.cnf

cp mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz /home/data/server/

cp mysql.cnf /etc/my.cnf

cd /home/data/server/

tar -xzvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz

mv mysql-5.7.21-linux-glibc2.12-x86_64 mysql

rm -rf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz

groupadd mysql

useradd -r -g mysql mysql

cd mysql

mkdir data

chown -R mysql /home/data/server/mysql/

chgrp -R mysql /home/data/server/mysql/

cd /home/data/server/mysql/bin

yum install -y libaio-devel.x86_64 numactl

./mysqld --initialize --user=mysql --basedir=/home/data/server/mysql/ --datadir=/home/data/server/mysql/data/

mkdir /var/log/mariadb

touch /var/log/mariadb/mariadb.log

chown -R mysql:mysql /var/log/mariadb/

cd /home/data/server/mysql/support-files/

cp mysql.server /etc/init.d/mysql

chmod +x /etc/init.d/mysql

yum install initscripts -y

service mysql start

chkconfig --add mysql

cd /home/data/server/mysql/bin

./mysql -u root <

涉及到的mysql.cnf内容如下:

[mysqld]

port = 13306

basedir=/home/data/server/mysql

datadir=/home/data/server/mysql/data

max_connections=1000

character-set-server=utf8

default-storage-engine=INNODB

lower_case_table_names=1

max_allowed_packet=20M

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

skip-grant-tables=1

# Settings user and group are ignored when systemd is used.

# If you need to run mysqld under a different user or group,

# customize your systemd unit file for mariadb according to the

# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]

log-error=/var/log/mariadb/mariadb.log

pid-file=/var/run/mariadb/mariadb.pid

注意事项:mysql.sh与mysql.cnf一定要放同一个目录哦。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值