• 安装mysql


    本次安装方式采用yum repo,请前往官网下载对应的版本,由于我的虚拟机安装的是centos7,所以选择Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package,详细的安装步骤请参考mysql官网安装手册

    当然,还有其他的安装方式,请参考mysql官网下载页面

    开始安装

    $ cd /usr/local/src
    $ wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
    $ yum localinstall mysql57-community-release-el7-11.noarch.rpm
    $ yum repolist enabled | grep "mysql.*-community.*"
    mysql-connectors-community/x86_64       MySQL Connectors Community           42
    mysql-tools-community/x86_64            MySQL Tools Community                51
    mysql57-community/x86_64                MySQL 5.7 Community Server          227
    $ yum install mysql-community-server
    $ service mysqld start #启动mysql
    $ service mysqld status #查看mysql状态,active(running)表示正在运行
    Redirecting to /bin/systemctl status mysqld.service
    ● mysqld.service - MySQL Server
       Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2017-10-26 10:56:36 CST; 1h 5min ago
         Docs: man:mysqld(8)
               http://dev.mysql.com/doc/refman/en/using-systemd.html
      Process: 2062 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
      Process: 1989 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
     Main PID: 2065 (mysqld)
       CGroup: /system.slice/mysqld.service
               └─2065 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
    
    Oct 26 10:56:30 localhost.localdomain systemd[1]: Starting MySQL Server...
    Oct 26 10:56:36 localhost.localdomain systemd[1]: Started MySQL Server.
    
    $ grep 'temporary password' /var/log/mysqld.log #查看mysql生成的临时密码
    2017-10-26T02:56:33.310140Z 1 [Note] A temporary password is generated for root@localhost: LiLd_/uo/5Zr #这个就是root的临时密码
    $ mysql -uroot -p #用临时密码登陆
    #修改root密码,由于默认开启了密码验证机制,mysql要求密码长度必须8位以上并带有大小写字母和特殊符号
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '%098NJImko';
    Query OK, 0 rows affected (0.00 sec)
    

    授权

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'web'@'%' IDENTIFIED BY '%678njiMKO' WITH GRANT OPTION;
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)
  • 相关阅读:
    8086汇编--1--通用寄存器和简单汇编指令
    写在前面的吐槽!
    汇编/Debug学习计划
    开篇-引文
    看懂别人的代码,和自己能写代码是两回事
    内存管理
    Flink基本原理及应用场景
    IDEA Maven Dependencies标红报错
    Spark Streaming流式处理
    Kafka
  • 原文地址:https://www.cnblogs.com/justlikeheaven/p/7735945.html
Copyright © 2020-2023  润新知