虚拟机安装Mysql

1.下载Mysql包,我这里用的是 mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz;

2.使用脚本创建Mysql,具体参考 https://blog.csdn.net/zfyy1989/article/details/88873438

遇到的问题:

1)重置root密码

1.1,vi  /etc/my.cnf
[mysqld]下加入参数skip-grant-tables   保存退出;

1.2  mysql无密码进入命令行并设置密码:

update user set authentication_string=password('root') where user='root';

1.3 将参数注释掉并重启服务:

2)Mysql默认无法远程连接,需要修改:

2.1 update user set host = ’%’ where user = ’root’;

3)navicat 远程连接报 Can't connect to MySQL server on ' '(10038)

需要修改防火墙:

重新载入
firewall-cmd --reload
查看
firewall-cmd --zone=public --query-port=3306/tcp
删除
firewall-cmd --zone=public --remove-port=3306/tcp --permanent

firewall-cmd --zone=public --add-port=3306/tcp --permanent (--permanent永久生效,没有此参数重启后失效)

firewall-cmd --zone=public --add-port=1000-2000/tcp --permanent
 

发布了25 篇原创文章 · 获赞 1 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/kimi_Christmas/article/details/100568935
今日推荐