在线安装MySQL
安装MySQL5.7
yum -y install mysql57-community-release-el7-10.noarch.rpm
若无可用安装包,执行下面这句
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
本地安装
yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
安装MySQL服务
yum install -y mysql-community-server
若报:mysql-community-common-5.7.42-1.el7.x86_64.rpm 的公钥尚未安装 执行下面安装,强制安装 --nogpgcheck跳过检查
yum install -y mysql-community-server --nogpgcheck
启动MySQL服务
systemctl start mysqld.service
查看MySQL状态
systemctl status mysqld.service
查找默认密码
grep “password” /var/log/mysqld.log
登录
mysql -uroot -p
修改密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123ABCdef*#’;
赋权
grant all privileges on . to ‘root’@‘%’ identified by ‘123ABCdef*#’ with grant option;