当前位置:网站首页>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
边栏推荐
- Overview of integrated learning
- 【AI应用】海康威视iVMS-4200软件安装
- [play with FPGA learning 5 in simple terms ----- reset design]
- Pit of the start attribute of enumrate
- The most detailed MySQL installation tutorial
- TIPC协议
- 2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
- Flick two open, realized a batch lookup join (with source code)
- 三.芯片啟動和時鐘系統
- Luogu p1892 [boi2003] Gang (and search for variant anti set)
猜你喜欢

二叉树专题--AcWing 3384. 二叉树遍历(已知先序遍历 边建树 边输出中序遍历)

V2x SIM dataset (Shanghai Jiaotong University & New York University)

PHP tea sales and shopping online store

洛谷 P5536 【XR-3】核心城市(贪心 + 树形 dp 寻找树的中心)
![Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)](/img/c2/bb85b681af0f78b380b1d179c7ea49.png)
Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)

Jinshanyun - 2023 Summer Internship

二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)

TIPC messaging3

Importerror: impossible d'importer le nom « graph» de « graphviz»

【深入浅出玩转FPGA学习4----漫谈状态机设计】
随机推荐
PCL eigen introduction and simple use
二叉树专题--洛谷 P3884 [JLOI2009]二叉树问题(dfs求二叉树深度 bfs求二叉树宽度 dijkstra求最短路)
三.芯片啟動和時鐘系統
Functional interfaces and method references
V2x SIM dataset (Shanghai Jiaotong University & New York University)
Iii. Système de démarrage et d'horloge à puce
Nodejs+express+mysql simple blog building
Thanos Receiver
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
What are the methods of adding elements to arrays in JS
Special topic of binary tree -- acwing 18 Rebuild the binary tree (construct the binary tree by traversing the front and middle order)
webauthn——官方开发文档
Special topic of binary tree -- Logu p1229 traversal problem (the number of traversals in the middle order is calculated when the pre and post order traversals of the multiplication principle are know
Implementation of six singleton modes
Uncover the secrets of Huawei application market application statistics
洛谷 P1892 [BOI2003]团伙(并查集变种 反集)
QT学习日记7——QMainWindow
The first white paper on agile practice in Chinese enterprises was released | complete download is attached
TIPC messaging3
LVM操作