当前位置:网站首页>MySQL之账号管理&&四大引擎&&建库建表
MySQL之账号管理&&四大引擎&&建库建表
2022-07-23 05:40:00 【_Leaf1217】
目录
一、MySQL的账号管理
1.1 前言
在前面的文章:MySQL的安装步骤---超详细版[附相关安装包]__Leaf1217的博客-CSDN博客_安装mysql安装包
我们学习了MySQL的详细安装步骤,而这篇文章就让我们一起来看看MySQL的相关知识吧!
1.2 创建用户的步骤
1.2.1 创建一个用户:
-- 创建用户zc
create user zc;1.2.2 设置密码:刚刚新创建一个用户是没有密码的,需要手动设置!
-- 设置密码
ALTER USER 'zc'@'%' IDENTIFIED WITH mysql_native_password BY '123456';1.2.3 查询用户信息:
-- 查询用户信息
select host,user,authentication_string from user;
1.2.4 给用户赋予权限:
-- 赋予权限
grant all on student.* to [email protected]'%';
-- 注释
grant 什么权限 on 当前连接的数据库名.* to 用户名@'%';1.2.5 撤销权限:
-- 撤销权限
revoke all on student.* from [email protected]'%';
-- 注释
revoke 什么权限 on 当前连接的数据库名.* from 用户名@'%';1.2.6 删除用户
-- 删除用户
drop user dd;二、四大引擎
2.1 四大引擎
四大引擎分别是:
其中MySQL建表默认使用的是InnoDB,就在表设计的选项里面可以选择切换。
比较常用的是:InnoDB、MyIsam;
他们的特点分别是:
-- 默认的是InnoDB;
-- InnoDB支持事务;
-- MyIsam不支持事务,但是查询速度快,支持全文索引。
三、建库建表
3.1 建库语法
-- 建表及约束 --
create table user(
id int primary key,
name varchar(18) not null,
sex char default '男',
sr datetime,
sfz varchar(18) unique
)3.2 查看表的详细信息
-- 查看表信息
desc user;
3.3 设计拓展字段
有的时候建表会设计拓展字段,应对突发情况需要增加列。
-- Extra:设计表时一般会设计拓展字段
create table userTo(
id int primary key,
name varchar(18) not null,
sex char default '男',
sr datetime,
sfz varchar(18) unique,
extra1 varchar(10),
extra2 varchar(50),
extra3 varchar(20),
extra4 varchar(18),
extra5 varchar(30),
extra6 varchar(90),
extra7 varchar(26),
extra8 varchar(50),
extra9 varchar(80)
)3.4 查询数据库
-- 查询数据库
show databases;
3.5 查看MySQL版本
-- 查看数据库版本
select version();
3.6 删除数据库
-- 删除表
drop table user;好啦,今天Leaf带来的关于MySQL的一些基本操作知识就到这里啦, 有问题可以私信或者评论问我噢,咱们下次见!!!
边栏推荐
猜你喜欢

简单实现矩形面积块

Py program can run, but the packaged exe prompts an error: recursion is detected when loading the "CV2" binary extension. Please check the opencv installation.

Spark common interview questions sorting

Cell sends SMS asynchronously

Web server failed to start. Port 8080 was already in use.
[email protected]‘] failed with code 1"/>npm init vite-app <project-name> 报错 Install for [‘[email protected]‘] failed with code 1

【C语言】什么是函数?函数的分类和侧重(帮你快速分类和记忆函数)

How to merge the website content with video and audio separated? How to write batch download code?

Clear the buffer with getchar (strongly recommended, C language is error prone, typical)
![[pytho-flask笔记5]蓝图简单使用](/img/0a/00b259f42e2fa83d4871263cc5f184.png)
[pytho-flask笔记5]蓝图简单使用
随机推荐
Analysis of two-part search method or half search method of C language (classic example, classic analysis)
Getting started with RPC and thrift
Keras保存训练过程中的最好模型
Cell sends SMS asynchronously
plsql创建Oracle数据库报错:使用Database Control配置数据库时,要求在当前Oracle主目录中配置监听程序 必须运行Netca以配置监听程序,然后才能继续。或者
高阶函数的应用:手写Promise源码(一)
视图的使用
Pywinauto+某应用程序(学习至第9讲)--受阻
[pytho-flask筆記5]藍圖簡單使用
Application of higher-order functions: handwritten promise source code (III)
js的call、apply、bind
第一篇博客
Rice mall registration
js的事件执行机制(Event loop)
TypeScript 常用类型
Burpsuite learning notes
my_ Implementation of strcpy (classic, simple, practical, collection)
页面实现 “实时数据响应” 的注意事项
The super simple face recognition API can realize face recognition in just a few lines of code
[untitled]