一、从官方下载并安装Yum Repository
1.下载Yum Repository
[root@localhost]# curl -O https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
2.安装Yum Repository
[root@localhost]# yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
3.查看可用的repo
[root@localhost]# yum repolist enabled|grep "mysql.*-community.*"
4.安装MySQL-Server
[root@localhost]# yum -y install mysql-community-server
二、配置并启动服务
1.启动服务
[root@localhost]# systemctl start mysqld
2.查看初始密码
[root@localhost]# grep 'temporary password' /var/log/mysqld.log
3.登录并修改密码
[root@localhost]# mysql -u root -p
4.设置密码
mysql>set password =password('Centos.mysql./8');
三、用Navicat连接测试
1.命令行登录mysql并查询用户对用的允许地址
use mysql;
select user,host from user;
2.修改用户权限
update user set host = '%' where user = 'root';
3.查看用户权限是否修改成功
select user,host from user where user="root";
4.更新数据库
flush privileges;
5.退出数据库
exit
6.打开防火墙端口3306
[root@localhost]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
7.重启防火墙
[root@localhost]# firewall-cmd --reload
8.查看已开放的端口
[root@localhost]# firewall-cmd --list-ports
操作完成,至此数据库安装成功并可以使用navicat连接了。