当前位置:网站首页>CentOS8之mysql基本用法
CentOS8之mysql基本用法
2022-07-02 09:32:00 【N64-HanYeWei】
1、 导入hellodb.sql生成数据库
前期准备安装mariadb-server
yum -y install mariadb-server
systemctl enable --now mariadb.service



导入数据库和表文件
(1) 在students表中,查询年龄大于25岁,且为男性的同学的名字和年龄

MariaDB [hellodb]> select name students_name,age students_age from students where age>=25 and gender='M';
(2) 以ClassID为分组依据,显示每组的平均年龄

MariaDB [hellodb]> select classid ,avg(age) from students group by classid;
(3) 显示第2题中平均年龄大于30的分组及平均年龄

MariaDB [hellodb]> select classid ,avg(age) 平均年龄 from students group by classid having 平均年龄>30;
(4) 显示以L开头的名字的同学的信息

MariaDB [hellodb]> select * from students where name like 'L%';
2、数据库授权magedu用户,允许192.168.1.0/24网段可以连接mysql
前期准备:




echo 1 > /proc/sys/net/ipv4/ip_forward--------开启路由功能

MariaDB [(none)]> grant all privileges on *.* to 'magedu'@'192.168.1.%' identified by '123456';-----------------创建用户并授权但在mysql-8.0已经取消这个功能

[[email protected] ~]# mysql -umagedu -h10.0.0.6 -p123456
边栏推荐
- 最详细MySql安装教程
- Static variables in static function
- 金山云——2023届暑期实习
- Functional interfaces and method references
- QT learning diary 7 - qmainwindow
- sql left join 主表限制条件写在on后面和写在where后面的区别
- The first white paper on agile practice in Chinese enterprises was released | complete download is attached
- 洛谷 P4281 [AHOI2008]紧急集合 / 聚会(树上倍增 LCA)
- Thanos Receiver
- spritejs
猜你喜欢

How does the whole network display IP ownership?

2022-06-17

OpenMLDB Meetup No.4 会议纪要

Special topic of binary tree -- acwing 1497 Traversal of the tree (use post and mid order traversal to build a binary tree)

Overview of integrated learning

金山云——2023届暑期实习

ctf 记录

enumrate的start属性的坑

三.芯片啟動和時鐘系統

MTK full dump grab
随机推荐
Internship report skywalking distributed link tracking?
[play with FPGA learning 4 in simple terms ----- talk about state machine design]
实验电镜距离测量之Matlab处理
Indexer in C #
Pit of the start attribute of enumrate
The working day of the month is calculated from the 1st day of each month
[in simple terms, play with FPGA learning 3 ----- basic grammar]
【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
启牛商学院给的股票账户安全吗?能开户吗?
Why does LabVIEW lose precision in floating point numbers
二叉树专题--洛谷 P1229 遍历问题(乘法原理 已知前、后序遍历求中序遍历个数)
二叉树专题--AcWing 3384. 二叉树遍历(已知先序遍历 边建树 边输出中序遍历)
I STM32 development environment, keil5/mdk5.14 installation tutorial (with download link)
PCL extracts a subset from a point cloud
Resources读取2d纹理 转换为png格式
String (Analog
Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)
TIPC messaging3
Special topic of binary tree -- acwing 18 Rebuild the binary tree (construct the binary tree by traversing the front and middle order)
K-d tree and octree of PCL