MySQL环境部署

rpm -qa | grep mysql
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
sudo yum install mysql-server
service mysqld restart
mysql -u root

mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'xxxxxx(password)' with grant option;

mysql> flush privileges;

mysql> exitx

查看数据库

show databases;

查看表单

show tables;
select Host,User,Password from user;
image.png
update user set Host='%' where User='root';
flush privileges;
image.png

部署端口:

1 登录控制台->安全组->配置规则->添加安全组->设置数据库默认的3306端口号,访问对象设置为 0.0.0.0/0

2 cmd设置防火墙

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

firewall-cmd 常用命令请见:firewall-cmd

你可能感兴趣的:(MySQL环境部署)