当前位置:Gxlcms > 数据库问题 > RHCE7.0答案之Mariadb

RHCE7.0答案之Mariadb

时间:2021-07-01 10:21:17 帮助过:5人阅读

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

人气教程排行