虚拟机centos7离线安装mysql

1.官网下载安装包


找到自己要的版本,centos用red hat的
在这里插入图片描述

2.通过vmware共享文件夹或者远程软件传包到/root下

3.清除centos7自带的mariaDB

找到有关Mariaadb的软件

rpm -qa | grep -i mariadb

卸载检测出来的软件,检测出多少卸载多少

rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

查找是否有相关配置目录及文件,如有,则 rm -rf 删除

find / -iname mariadb

4.将安装包解压

 tar -xvf MySQL-5.6.47-1.el7.x86_64.rpm-bundle.tar

按顺序安装下面三个rpm

rpm -ivh /root/MySQL-server-5.6.47-1.el7.x86_64.rpm
rpm -ivh /root/MySQL-devel-5.6.47-1.el7.x86_64.rpm
rpm -ivh /root/MySQL-client-5.6.47-1.el7.x86_64.rpm

启动mysql

 service mysql start

5.mysql初始化配置

之前安装第一个rpm的时候有提示语
You will find that password in ‘/root/.mysql_secret’.
按照提示找到初始密码并复制下来

cat /root/.mysql_secret

按照之前提升初始化mysql
In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

/usr/bin/mysql_secure_installation

会让及输入之前查看的初始密码
之后问你怎么设置只管y就够了
第一个y是设置新密码

扫描二维码关注公众号,回复: 9567797 查看本文章

6.然后重启服务,登录

 systemctl restart mysql.service
mysql -uroot -p
发布了2 篇原创文章 · 获赞 7 · 访问量 70

猜你喜欢

转载自blog.csdn.net/qq_44174148/article/details/104634119