Centos7 安装mysql服务器并开启远程访问功能
2022/7/12 2:22:42
本文主要是介绍Centos7 安装mysql服务器并开启远程访问功能,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
华为云服务器 Centos7 安装mysql服务器并开启远程访问功能,过程记录
安装 (以root身份操作):
1. yum -y install weget
2. wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
3. yum -y install mysql57-community-release-el7-10.noarch.rpm
使用yum -y install mysql-community-server安装mysql时候提示:
The GPG keys listed for the “MySQL 5.7 Community Server” repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.
Failing package is: mysql-community-libs-compat-5.7.37-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
原因是Mysql的GPG升级了,需要重新获取
4. rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
5.yum install mysql-server
配置
6. systemctl start mysqld.service
7. systemctl status mysqld.service
8. grep "password" /var/log/mysqld.log
9. mysql -uroot -p
10. ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
其中‘new password’替换成你要设置的密码,注意:密码设置必须要大小写字母数字和特殊符号(,/';:等),不然不能配置成功
远程访问
11. grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option;
12. flush privileges;
13. exit
其他配置
14. systemctl start firewalld
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload 15. 先退出mysql,然后再到、etc目录下的my.cnf文件下修改一下文件内容 vim /etc/my.cnf
参考链接:
https://blog.csdn.net/searlas/article/details/123393829?spm=1001.2014.3001.5506
https://blog.csdn.net/qq_36582604/article/details/80526287?spm=1001.2014.3001.5506
这篇关于Centos7 安装mysql服务器并开启远程访问功能的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-04-26MySQL查出时间比实际晚8小时的解决方案
- 2024-04-01JPA不识别MySQL的枚举类型
- 2024-03-30mysql数据库表卡死解决方法
- 2024-03-15MySQL多数据源笔记5-ShardingJDBC实战
- 2024-03-11natural join mysql
- 2024-03-11关于VS2017,VS2015 中利用 EF使用Mysql 不显示数据源问题解决方案
- 2024-02-26mysql 阿里云xb后缀备份文件恢复-icode9专业技术文章分享
- 2024-02-22docker mysql 5.7
- 2024-02-18从 20 多套 MySQL 到 1 套 TiDB丨骏伯网络综合运营管理平台应用实践
- 2024-02-07mysql 外键索引入门介绍,为什么工作中很少有人使用?