各位用户为了找寻关于CentOS7安装MySQL 8.0.26的过程的资料费劲了很多周折。这里教程网为您整理了关于CentOS7安装MySQL 8.0.26的过程的相关资料,仅供查阅,以下为您介绍关于CentOS7安装MySQL 8.0.26的过程的详细内容

1、首先,根据自己的机子到mysql官网下载对应的数据库 https://dev.mysql.com/downloads/mysql/

2、利用xftp上传压缩包到虚拟机或者服务器的某个文件夹中,最后把mysql压缩包解压到自定义目录,如果你在linux下载此步骤跳过(方法不限)。

3、卸载mariadb数据库,先查看mariadb的安装包,然后卸载,最后可再次查看确认,命令如下:

? 1 2 rpm -qa | grep mariadb rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps

4、把上传的mysql安装包解压,解压命令格式:tar -xvf **,如我解压到/software/mysql目录,如下所示:

? 1 tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar

5、然后安装下列列表中的选项,其余的可以不用管:

mysql-community-common mysql-community-libs mysql-community-client mysql-community-server

命令如下:

? 1 2 3 4 rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm --nodeps –force rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm --nodeps –force rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm --nodeps --force rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm --nodeps --force

 执行情况如下:

6、查看已安装的mysql资源

? 1 rpm -qa | grep mysql

7、输入以下命令,完成对mysql的初始化及相关配置

? 1 2 3 4 mysqld --initialize chown mysql:mysql /var/lib/mysql -r systemctl start mysqld.service systemctl enable mysqld

8、查看数据库的初始密码,命令如下:

? 1 cat /var/log/mysqld.log | grep password

9、使用root用户登录mysql,输入初始密码

? 1 mysql -u root -p

10、修改root密码,然后再exit退出 验证一下密码,命令如下:

? 1 alter user "root"@"localhost" identified by 1qaz@2wsx;

11、通过以下命令,进行远程访问的授权

? 1 2 3 create user 'root'@'%' identified with mysql_native_password by '1qaz@2wsx'; grant all privileges on *.* to 'root'@'%' with grant option; flush privileges--立即生效

12、通过一下命令修改加密规则,mysql8.0 版本 和 5.0 的加密规则不一样,而现在的可视化工具只支持旧的加密方式,最后刷新修改后的权限。

? 1 2 alter user 'root'@'localhost' identified by '1qaz@2wsx' password expire never; flush privileges;

13、通过以下命令,关闭 firewall

? 1 2 3 systemctl stop firewalld.service systemctl disable firewalld.service systemctl mask firewalld.service

14、安装iptables防火墙,出现完成!或者complete!即为成功,命令如下:

? 1 yum -y install iptables-services

15、通过以下命令启动设置防火墙

? 1 2 systemctl enable iptables; systemctl start iptables;

16、通过vi /etc/sysconfig/iptables命令编辑防火墙,添加端口

? 1 vi /etc/sysconfig/iptables

-a input -m state --state new -m tcp -p tcp --dport 80 -j accept -a input -m state --state new -m tcp -p tcp --dport 3306 -j accept -a input -m state --state new -m tcp -p tcp --dport 443 -j accept -a input -m state --state new -m tcp -p tcp --dport 8080 -j accept -a input -m state --state new -m tcp -p tcp --dport 8090 -j accept

17、通过以下命令重启防火墙使配置生效:

? 1 systemctl restart iptables.service

18、通过命令设置防火墙开机启动:

? 1 systemctl enable iptables.service

19、最后使用客户端工具连接测试即可。

到此这篇关于centos 7安装mysql 8.0.26的文章就介绍到这了,更多相关centos 7安装mysql 8.0.26内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

原文链接:https://blog.csdn.net/m0_61008247/article/details/120127587