CentOS7安装MySQL数据库&&Navict成功连接
程序员文章站
2022-05-30 12:15:08
...
一、从官方下载并安装Yum Repository
1.下载Yum Repository
[[email protected]]# curl -O https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
2.安装Yum Repository
[[email protected]]# yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
3.查看可用的repo
[[email protected]]# yum repolist enabled|grep "mysql.*-community.*"
4.安装MySQL-Server
[[email protected]]# yum -y install mysql-community-server
二、配置并启动服务
1.启动服务
[[email protected]]# systemctl start mysqld
2.查看初始密码
[[email protected]]# grep 'temporary password' /var/log/mysqld.log
3.登录并修改密码
[[email protected]]# 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
[[email protected]]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
7.重启防火墙
[[email protected]]# firewall-cmd --reload
8.查看已开放的端口
[[email protected]]# firewall-cmd --list-ports
操作完成,至此数据库安装成功并可以使用navicat连接了。
上一篇: 课堂笔记--MySQL常用函数讲解
下一篇: node:爬虫爬取网页图片