服务器安装部署MySQL国内镜像网站下载解决方法

前言

首先,我们要知道MySQL的国内镜像网站地址
然后就可以进行寻找及下载

访问国内mysql镜像站

  1. 中国科学技术大学开源软件镜像

  2. http://mirrors.ustc.edu.cn/
    在这里插入图片描述
    在这里插入图片描述
    或者可以直接在上面搜索:
    在这里插入图片描述
    点击这里:
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    3.下载软件包(这里以mysql8.0为例)

    1. 官方地址下载或百度网盘下载

      Index of /mysql-repo/yum/mysql-5.7-community/el/7/x86_64/

    2. mysql80

https://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/

Index of /mysql-repo/yum/mysql-8.0-community/el/7/x86_64/

需要的依赖包有以下6个

mysql-community-client-8.0.31-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.31-1.el7.x86_64.rpm
mysql-community-common-8.0.31-1.el7.x86_64.rpm
mysql-community-icu-data-files-8.0.31-1.el7.x86_64.rpm
mysql-community-libs-8.0.31-1.el7.x86_64.rpm
mysql-community-server-8.0.31-1.el7.x86_64.rpm

wget https://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/mysql-community-server-8.0.31-1.el7.x86_64.rpm
wget https://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-8.0.31-1.el7.x86_64.rpm
wget https://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/mysql-community-icu-data-files-8.0.31-1.el7.x86_64.rpm
wget https://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/mysql-community-common-8.0.31-1.el7.x86_64.rpm
wget https://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-plugins-8.0.31-1.el7.x86_64.rpm
wget https://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.31-1.el7.x86_64.rpm
  1. 查看
ls ./

请添加图片描述

  1. 安装相关软件

如果装的是mysql5.7>需要安装三个相关软件

8.0不需要

yum  install  -y   net-tools.x86_64    libaio.x86_64    perl.x86_64
  1. 安装Mysql服务器

  2. 安装主包即可

yum install -y mysql-community-server
  1. 报错信息
    请添加图片描述
  2. 解决方法:卸载冲突的软件包,再安装
 yum remove -y mariadb-libs-5.5.60-1.el7_5.x86_64
 yum remove -y mariadb-libs


yum install -y mysql-community*

如果提示如下报错:

表示安装server,需要其他的依赖

请添加图片描述
解决方案:

yum install -y mysql-community*
  1. 安装完毕的提示:
    请添加图片描述

  2. 启动Mysql服务器

[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl enable mysqld
[root@localhost ~]# systemctl status mysqld

[root@localhost ~]# ps -aux |grep mysql
mysql     31791  7.3 20.1 1798984 374516 ?      Ssl  02:14   0:01 /usr/sbin/mysqld
  1. 查询Mysql服务器默认密码
grep 'password' /var/log/mysqld.log 

注意:

​ 没有查到密码的原因,是因为没有启动成功。

请添加图片描述
冒号和空格的后面,全都是密码

​ 登录:

  • 可以正常登录,但是无法操作数据库服务器,需要我们修改密码才能操作
mysql -uroot -p'-u4mT?ry#jjn'
[root@web2 ~]# mysql -uroot -p'-u4mT?ry#jjn'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.31

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql>

请添加图片描述

  1. 修改Mysql服务器密码
修改密码语法:
ALTER USER '数据库用户名'@'localhost' IDENTIFIED BY '新的密码';
[root@web2 ~]# mysql -uroot -p'-u4mT?ry#jjn'
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

#上述提示错误,表示输入的密码太简单
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Nem_Passwd@123';
Query OK, 0 rows affected (0.00 sec)

修改密码为:Nem_Passwd@123 
  1. 登录Mysql系统
[root@localhost ~]# mysql -uroot -p'Nem_Passwd@123'
mysql> show databases;

  1. 查到默认数据库
    在这里插入图片描述
    实验完成
  • 6
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值