微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

一、MySQL在Centos7中的应用

一、Centos7系统中的MariaDB 数据库

        CentOS 7/RHEL7中,认已经不再提供MysqL的安装源,取而代之的是MysqL的原开发者另起炉灶开发的MariaDB 数据库,MariaDB 是MysqL一个分支,从MysqL被甲骨文收购之后开发的一个替代品,不仅完全兼容MysqL而且比MysqL更加强大。

   1、首先需要安装  MariaDB 数据库    

      输入命令:      sudo  yum install mariadb-server

   2、安装完成后,需启动数据库

           命令:systemctl start madiadb

注:Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器。

查看数据库状态 :systemctl status mariadb     

systemctl start mariadb       //启动
systemctl restart mariadb    //重启
systemctl stop mariadb        //停止
systemctl reload mariadb     //重新加载
systemctl status mariadb     //查看状态
systemctl enable mariadb     //开机自启动
systemctl is-enabled mariadb     //查询是否彭重为开机自启动
systemctl disable mariadb     //取消开机自启动
systemctl mask  mariadb      //禁用
systemctl unmask mariadb    //取消禁用

  3、数据库启动以后,就可以进入MysqL

 输入命令: MysqL -h(主机名或者主机IP )-u(用户名) -p(用户密码)

eg:   MysqL -uroot -p

注:第一次登录一般都是没有密码,有密码的话为  toor

[root@localhost ~]# MysqL -uroot       //第一次登录使用没有密码,所以没有 -p 项
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.68-MariaDB MariaDB Server

copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>      //出现此处,说明已经进入MysqL

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐