zoukankan      html  css  js  c++  java
  • 在CentOS7中安装MySQL, 基于MySQL官网文档

    在CentOS7中安装MySQL, 基于官网文档

    前言

    版本

    CentOS7, 安装于windows的VMWare

    MySQL5.7.13

    个人小创举

    这次安装经历很多困难, 一开始, 惯性思维+懒惰, 不愿意多费力费脑, 在中文网站找别人咀嚼过的解决方案, 但都被各种来回抄的答案坑惨.

    后来没办法硬着头皮看MySQL官网的文档, 一开始还是用浏览器的全页翻译, 也很惨. 反而, 后来换成英文原文越看越深入, 越有感觉, 偶尔专业名词和记不清的词翻译一下, 居然解决了问题!

    意义重大. 不止于这个问题的解决, 更重要的在于, 是首次完全通过官方英文文档解决的有难度的问题! 英文阅读, 并非高不可攀.

    开始

    准备工作

    安装rz

    可以通过xshell传输文件的工具

    yum install lrzsz
    

    安装依赖

    yum -y install wget # 下载东西用的
    yum -y install setup # 不过提示已经有最新版本了
    yum -y install perl # 安装server要求的依赖
    yum -y install net-tools # 安装server时候要求的依赖
    

    卸载系统自带的mariadb

    确认存在性

    rpm -qa | grep mariadb
    

    卸载

    rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps
    

    --nodeps : 强制

    下载安装

    在linux的/目录下的自己的文件夹mine中(后来成功的那次没有用这个文件夹, 而是~目录)

    下载

    wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
    

    但是, wget这次找的mirror太慢, 20k/s大概需要超过5h, 所以改用迅雷, 十多分钟搞定, 然后通过xshell传入虚拟机

    解压

    tar xvf mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar 
    

    安装

    rpm -ivh [filename.rpm]
    

    有依赖关系, 存在顺序性:

    1. rpm -ivh mysql-community-common-5.7.13-1.el7.x86_64.rpm
      
    2. rpm -ivh mysql-community-libs-5.7.13-1.el7.x86_64.rpm
      
    3. rpm -ivh mysql-community-libs-compat-5.7.13-1.el7.x86_64.rpm
      
    4. rpm -ivh mysql-community-client-5.7.13-1.el7.x86_64.rpm 
      
    5. rpm -ivh mysql-community-server-5.7.13-1.el7.x86_64.rpm
      

    配置

    启动:

    需要手动启动

    MySQL is not automatically started at the end of the installation process.

    sudo service mysqld start
    

    获取临时密码:

    会得到一个临时密码temporary password 保存在/var/log/mysqld.log中, 找出它

    A superuser account 'root'@'localhost' is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command for RHEL, Oracle Linux, CentOS, and Fedora systems:

    grep 'temporary password' /var/log/mysqld.log
    
    # 执行结果
    2019-11-28T11:09:49.966857Z 1 [Note] A temporary password is generated for root@localhost: OUhb%s4)8ht;
    

    **登录 **

    mysql -uroot -p
    # 临时密码, 注意复制要完整, 换行可能被忽略
    

    修改密码

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED by 'aNewPassWordHere';
    

    注意: 用root作密码会说不符合当前要求

    如果安装过程中报错, 官方提示:

    If something goes wrong during installation, you might find debug information in the error log file /var/log/mysqld.log.

  • 相关阅读:
    js总结:增加和减少文本框
    java总结:字符串切割
    Spring-----ioc
    Hibernate之二级缓存
    Hibernate之HQL
    Hibernate关联关系(一对多自关联 ,多对多)
    Hibernate关联关系(一对多)
    Hibernate之主键生成策略
    如何使用hibernate完成CRUD操作
    Struts2-----文件上传与拦截器原理
  • 原文地址:https://www.cnblogs.com/clzhang/p/12643699.html
Copyright © 2011-2022 走看看