998yty 发表于 2016-10-31 10:30:24

RHCE7.0答案之Mariadb

                      Mariadb配置:

[*]yum groupinstall mariadb mariadb-client
yum grouplist |grep maria

[*]systemctl enable mariadb.service
systemctl restart mariadb.service

[*]firewall-cmd --permanent --add-service=mysql
firewall-cmd --reload
firewall-cmd --permanent --list-all

[*]mysql_secure_installation, 输入root密码,初始为空。
set root password->Remove anon user?yes->Disallow root login?yes->Remove test database?yes->Reload?yes

[*]mysql -uroot -ptianyun; 创建数据库

[*]show databases;
create database concats; show databases;

[*]导入数据库:
mysql -uroot -ptianyun concats < /home/student/mariadb.dump
或者:
use concats; select database();
source /home/student/mariadb.dump;
show tables; 可以看到一张相应的表

[*]授权用户访问, 可能要指定网段
help grant; 查看授权命令
grant select (limitation list) on concats.* to 'luigi@'%

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

[*]mysql -uluigi -h 172.25.0.11 -ptianyun
use concats; select * from product;

[*]单表查询:


[*]desc product \G 或 desc product;查看表结构

[*]select * from product where id_category='2'

[*]select count(*) from product where id...

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

[*]select * from product where name regexp '^T'; 正则表达式

                   

imissmylove 发表于 2018-1-26 17:16:49

多谢楼主分享
页: [1]
查看完整版本: RHCE7.0答案之Mariadb