zoukankan      html  css  js  c++  java
  • Centos上安装MySQL

    1、去官网查找最新(你需要的)安装包版本
    # https://dev.mysql.com/downloads/repo/yum/

    2、下载MySQL安装包

    # wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

    3、安装MySQ源

    # yum -y install mysql80-community-release-el7-3.noarch.rpm
    

    4、查看安装结果

    # yum repolist enabled | grep mysql.*
    mysql-connectors-community/x86_64       MySQL Connectors Community           128
    mysql-tools-community/x86_64            MySQL Tools Community                100
    mysql80-community/x86_64                MySQL 8.0 Community Server           145
    

    5、安装MySQL服务

    # yum install mysql-community-server -y

    6、启动MySQL

    # service mysqld start
    # netstat -lntp | grep 3306            //查看3306端口是否起了
    # systemctl status mysqld.service      //查看MySQL的运行状态

    7、查看MySQL日志,筛选出临时密码

    # grep "password" /var/log/mysqld.log

    8、用临时密码登录到MySQL

    # mysql -uroot -p

    9、更改root密码,密码要大小写加字符(密码有复杂性要求)

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpasswd'

    10、修改 /etc/my.cnf 或 /etc/mysql/my.cnf,文件加入 utf-8编码

    # vim /etc/my.cnf                  //把下面代码粘进去就好
    [client]
    default-character-set = utf8
    [mysqld]
    default-storage-engine = INNODB
    character-set-server = utf8
    collation-server = utf8_general_ci
     
    # service mysqld restart          //重启数据库即可
     
  • 相关阅读:
    我们在期待什么?
    ASP.NET的本质–IIS以及进程模式
    javascript开发中要注意的事情
    通过配置web.config发电子邮件详解
    VS2005 中文版下载
    td自动换行CSS
    巧妙利用图片IMG的onerror事件
    网页 页面不缓存
    JS检测对像(支持多版本)
    利用js预缓存图片
  • 原文地址:https://www.cnblogs.com/BrotherCat/p/11676283.html
Copyright © 2011-2022 走看看