码迷,mamicode.com
首页 > 数据库 > 详细

RHCE7.0答案之Mariadb

时间:2016-10-28 17:51:59      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:rhce

Mariadb配置:

  1. yum groupinstall mariadb mariadb-client

    yum grouplist |grep maria

  2. systemctl enable mariadb.service

    systemctl restart mariadb.service

  3. firewall-cmd --permanent --add-service=mysql

    firewall-cmd --reload

    firewall-cmd --permanent --list-all

  4. mysql_secure_installation, 输入root密码,初始为空。

    set root password->Remove anon user?yes->Disallow root login?yes->Remove test database?yes->Reload?yes

  5. mysql -uroot -ptianyun; 创建数据库

  6. show databases;

    create database concats; show databases;

  7. 导入数据库: 

    mysql -uroot -ptianyun concats < /home/student/mariadb.dump

    或者:

    use concats; select database();

    source /home/student/mariadb.dump;

    show tables; 可以看到一张相应的表

  8. 授权用户访问, 可能要指定网段

    help grant; 查看授权命令

    grant select (limitation list) on concats.* to ‘luigi@‘% 

  9. flush privileges 刷新权限列表(系统关键字不分大小写,表名和库名分大小写)

  10. mysql -uluigi -h 172.25.0.11 -ptianyun

    use concats; select * from product;

  11. 单表查询:

    1. desc product \G 或 desc product;  查看表结构

    2. select * from product where id_category=‘2‘

    3. select count(*) from product where id...

    4. select * from product where ... and ... 下划线_表示匹配一个字符,%表示多个

    5. select * from product where name regexp ‘^T‘; 正则表达式 

RHCE7.0答案之Mariadb

标签:rhce

原文地址:http://ponyjia.blog.51cto.com/917324/1866831

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!