zoukankan      html  css  js  c++  java
  • CentOS 7 安装 mariaDB

    1、安装数据库

    [root@localhost ~]# yum -y  install mariadb-server mariadb mariadb-devel

    2、启动数据库
    [root@localhost ~]# systemctl start mariadb
    [root@localhost ~]# systemctl enable mariadb

    3、开通防火墙
    [root@localhost ~]# firewall-cmd --permanent --add-service mysql
    [root@localhost ~]# systemctl restart firewalld.service
    [root@localhost ~]# iptables -L -n|grep 3306

    4、修改root用户的密码以及打开远程连接
    [root@localhost ~]# mysql -uroot -p

    Enter password:                                //密码默认为空,回车即可
    Welcome to the MariaDB monitor. Commands end with ; or g.
    Your MariaDB connection id is 2
    Server version: 5.5.50-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)]> show databases;

    MariaDB [(none)]> use mysql

    MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";

    MariaDB [mysql]> update user set Password = password('123') where User='root';

    MariaDB [mysql]> flush privileges;       //使设置生效

    扩展阅读:

    systemctl是RHEL7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。可以使用它永久性或只在当前会话中启用/禁用服务。
    启动一个服务:systemctl start postfix.service
    关闭一个服务:systemctl stop postfix.service
    重启一个服务:systemctl restart postfix.service
    显示一个服务的状态:systemctl status postfix.service
    在开机时启用一个服务:systemctl enable postfix.service
    在开机时禁用一个服务:systemctl disable postfix.service
    查看服务是否开机启动:systemctl is-enabled postfix.service
    查看已启动的服务列表:systemctl list-unit-files|grep enabled
    查看启动失败的服务列表:systemctl --failed

    显示权限:ls -lh  
    设置目录的所有人(u)、群组(g)以及其他人(o)以读(r )、写(w)和执行(x)的权限:chmod 777 directory1  
    删除群组(g)与其他人(o)对目录的读写执行权限:chmod 700 directory1  
    改变一个文件file1的所有人属性为use1:chown user1 file1  
    改变一个目录的所有人属性并同时改变改目录下所有文件的属性都为use1所有:chown -R user1 directory1 

    查看磁盘空间大小:

    # df -h
    # fdisk -l

  • 相关阅读:
    Redis和Memcache区别,优缺点对比
    C# 修改Config文件,增删查改
    SQL SERVER-时间戳(timestamp)与时间格式(datetime)互相转换
    post数据时报错:远程服务器返回错误: (400) 错误的请求。
    Win10 通过附加进程调试时出现“此任务要求应用程序具有提升的权限”
    谈谈技术原则,技术学习方法,代码阅读及其它
    C# 对象与JSON字符串互相转换的三种方式
    JSON.stringify 语法实例讲解
    前端Json对象与Json字符串互转(4种转换方式)
    Razor引擎学习:RenderBody,RenderPage和RenderSection
  • 原文地址:https://www.cnblogs.com/101key/p/6112270.html
Copyright © 2011-2022 走看看