安装
Mysql的官网下载yum repo配置文件
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
yum源的安装
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum命令安装mysql
yum -y install mysql-server
登录
启动mysql
systemctl start mysqld
查看mysql状态
systemctl status mysqld
获取mysql的临时密码
grep ‘temporary password’ /var/log/mysqld.log
登录mysql
mysql -u root -p
按照系统的默认要求,修改密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘-520Lemon-’;
密码策略
修改密码策略
SHOW VARIABLES LIKE ‘validate_password%’;
将密码安全等级设置为low
set global validate_password_policy=0;
将密码长度设置为最小6位
set global validate_password_length=6;
修改密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
远程连接
查看数据库的用户信息
show databases;
use mysql;
select host,user from user;
赋权,在任意的主机上连接
update user set Host=’%’ where User=‘root’;
GRANT ALL PRIVILEGES ON . TO ‘lemon’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
刷新
flush privileges;
开放端口
firewall-cmd –zone=public –add-port=3306/tcp –permanent
firewall-cmd –reload
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/78396.html