zoukankan      html  css  js  c++  java
  • centos7 yum 安装mariadb

    #vim /etc/yum.repos.d/mariadb.repo

    [mariadb]
    name = MariaDB
    baseurl = https://yum.mariadb.org/10.1.16/centos7-amd64   //不同系统、版本更改此设置
    gpgkey=http://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1

    #yum install  MariaDB-client MariaDB-client -y

    依赖关系解决

    ========================================================================================================================
    Package                                架构                      版本          源        大小
    ========================================================================================================================
    正在安装:
    MariaDB-client        x86_64               10.1.16-1.el6              mariadb      40 M
    MariaDB-server       x86_64               10.1.16-1.el6              mariadb      104 M
    为依赖而安装:
    MariaDB-common      x86_64              10.1.16-1.el6               mariadb      42 k
    MariaDB-compat         x86_64              10.1.16-1.el6               mariadb      2.7 M
    jemalloc            x86_64              3.6.0-1.el7                   epel        105 k

    事务概要
    ========================================================================================================================
    安装 2 软件包 (+3 依赖软件包)

    总下载量:147 M
    安装大小:623 M
    Is this ok [y/d/N]: y

    #cp /usr/share/mysql/my-large.cnf /etc/my.cnf  

    #grep bind /etc/my.cnf
    bind = 192.168.0.28

    #mkdir  /data

    #chown mysql:mysql /data

    #mv /var/lib/mysql  /data/mysql

    #ln -s /data/mysql /var/lib/mysql

    #systemctl start mysql.service

    #systemctl enable mysql.service

    #mysql_secure_installation

    为了保证数据库的安全性,一定要进行初始化工作:

    第1步:设定root用户密码。
    第2步:删除匿名帐号。
    第3步:禁止root用户从远程登陆。
    第4步:删除test数据库并取消对其的访问权限。
    第5步:刷新授权表,让初始化后的设定立即生效。

    使用root用户登陆到数据库中:

    #mysql -uroot -p
    Enter password:
    Welcome to the MariaDB monitor. Commands end with ; or g.
    Your MariaDB connection id is 10
    Server version: 10.1.16-MariaDB MariaDB Server

    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

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

    MariaDB [(none)]>

    查看当前已有的数据库:

    MariaDB [(none)]> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    +--------------------+
    3 rows in set (0.00 sec)

    修改当前用户在数据库中的密码:

    MariaDB [(none)]> set password = password('testpassw0rd');
    Query OK, 0 rows affected (0.01 sec)
     
  • 相关阅读:
    169. Majority Element
    283. Move Zeroes
    1331. Rank Transform of an Array
    566. Reshape the Matrix
    985. Sum of Even Numbers After Queries
    1185. Day of the Week
    867. Transpose Matrix
    1217. Play with Chips
    766. Toeplitz Matrix
    1413. Minimum Value to Get Positive Step by Step Sum
  • 原文地址:https://www.cnblogs.com/chenjiahe/p/5718385.html
Copyright © 2011-2022 走看看