CentOS部署MYSQL

1. 卸载mariadb(如有)

rpm -qa | grep mariadb

rpm -e --nodeps mariadb*包名

2. 安装MYSQL

yum install -y https://repo.mysql.com/mysql80-community-release-el7.rpm

yum install mysql-community-server

systemctl start  mysqld.service

3. 配置MYSQL

grep"password" /var/log/mysqld.log  //查看初始密码

mysql -uroot -p密码

set globalvalidate_password.policy=0;

set globalvalidate_password.length=8;

ALTER USER'root'@'localhost' IDENTIFIED BY 'Mysql密码';

exit

mysqld --verbose--help | grep -A 1 "Default options"

vim /etc/my.cnf

default_password_lifetime=0

systemctl enable mysqld.service

systemctl restart mysqld.service

firewall-cmd--zone=public --add-port=3306/tcp --permanent

firewall-cmd--reload

你可能感兴趣的:(CentOS部署MYSQL)