1.配置yum

2.安装
yum install mariadb-server
3.查看rpm -ql MariaDB-server | grep service
4.systemctl start mariadb

5.测试


6.安全加固
mysql_secure_installation
7.导入
mysql -uroot -p111111 < hellodb.sql

(1) 在students表中,查询年龄大于25岁,且为男性的同学的名字和年龄
1.use hellodb
2.select name,age from students where age>25 and gender=‘M‘ ;

(2) 以ClassID为分组依据,显示每组的平均年龄
select classid,AVG(age) as 平均年龄 from students group by classid

(3) 显示第2题中平均年龄大于30的分组及平均年龄
select classid,AVG(age) as 平均年龄 from students group by classid having 平均年龄>30

(4) 显示以L开头的名字的同学的信息
select * from students where name like ‘L%‘

1.use mysql;
2.create user ‘jiapeng‘@‘192.168.111.%‘ identified by ‘123456‘;
3.flush privileges;

测试,在130客户端进行远程连接
mysql -ujiapeng -p123456 -h 192.168.111.156

此时发现没有权限,再次进入服务的用户授权
grant all on . to jiapeng@‘192.168.111.%‘ identified by "123456";
再次查看拥有所有的权限

原文:https://www.cnblogs.com/jiapengchu/p/13768497.html