ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Centos7 安装mysql服务器并开启远程访问功能

2022-07-10 21:04:01  阅读:230  来源: 互联网

标签:-- GPG Centos7 yum install mysql 服务器 password


华为云服务器 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



 
 

 

标签:--,GPG,Centos7,yum,install,mysql,服务器,password
来源: https://www.cnblogs.com/nefu-wangxun/p/16463994.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有