Centos7 安装MySQL8.0
MySQL安装和配置
1. 安装
-
检查mysql和mysql-server是否安装
rpm -qa | grep mysql rpm -qa | grep mysql-server
-
如果之前安装过进行卸载
yum -y remove mysql*
-
下载安装MySQL的repo源
https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpmwget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm rpm -ivh mysql80-community-release-el7-3.noarch.rpm
-
安装mysql 服务器(一路yes)
yum install mysql-community-server
-
安装成功后启动服务
systemctl start mysqld
-
查看默认密码
sudo grep 'temporary password' /var/log/mysqld.log
-
查看3306端口是否开放
netstat –ant
-
将mysql添加为自启动服务
systemctl enable mysqld
2. 配置
-
登录MySQL,密码为之前第6步查询出来的
mysql -u root -pxxx
-
修改 root 登录密码 (此时密码要根据密码规则设定)
alter user 'root'@'localhost' identified by 'xxx';
-
默认MySQL只允许localhost 登录,修改允许其他主机连接
CREATE USER 'root'@'%' IDENTIFIED BY 'password'; GRANT ALL ON *.* TO 'root'@'%'; FLUSH PRIVILEGES; ## 查看更新后数据 use mysql; select host, user, authentication_string, plugin from user;
-
创建其他用户并赋权
create user ‘用户名’@’访问主机’ identified by ‘密码’; grant 权限列表 on 数据库.表 to ‘用户名’@’访问主机’;(修改权限时在后面加with grant option)
附录:
- 密码策略:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
安装MySQL报错 : Your password does not satisfy the current policy requirements
原文地址:https://segmentfault.com/a/1190000021285702
相关推荐
-
Linux运维-搭建高可用Redis缓存 服务器
2019-1-31
-
Ignite集成Spark之IgniteRDD 服务器
2020-6-13
-
Redis主从复制 服务器
2019-10-5
-
StatefulSets迁移PV的方法 服务器
2020-6-24
-
mysql服务器架构 服务器
2019-8-17
-
Innodb 共享锁 排他锁 及应用 服务器
2019-8-21
-
debian 9 双显卡安装NVIDIA显卡驱动 服务器
2019-10-5
-
如何设计一个百万级的消息推送系统? 服务器
2020-6-20
-
使用webpack前端重构感受 服务器
2020-6-22
-
记一次服务器被植入挖矿木马cpu飙升200%解决过程 服务器
2020-6-21