当前位置:网站首页>Account management, database building and four engines + cases of MySQL
Account management, database building and four engines + cases of MySQL
2022-06-27 00:53:00 【ˡ A cup of American style】
1、 Find the database engine
show engines;
2、 Create database
#create database Database name
create database text;
# Complete writing
create database if not exists text default charset utf8 collate utf8_general_ci;
3、 Lookup database
show databases;
5、 Account management
#5.1、 Create user and set password
create user zking identified by '123456';
#5.2、 Switching users
use mysql;
#5.3、 View user information
#192.168.1.% ipv4 ipv6
select * from user;
select host,user,authentication_String from user;
4、 Delete database ( Divine user , Recommended disable ;)
drop user zking;
6 Change Password
set password for zking=password('1234');
7 Refresh configuration
flush privileges;
8 to grant authorization (grant)
# grammar :grant all [pricilenges] on databasename.tablename to user name @'%'
#garnt all on *.* to [email protected]'%';
grant select,delete on t277.t_book to [email protected]'%';
9 Withdrawal of power (revoke)
# grammar :revoke all [privileges] on dataasename.tablename from user name @'%';
#revoke all on *.* from [email protected]'%';
revoke select on t277.t_book from [email protected]'%';
10 Query authority
show grants for zking;
Here is a case
#decimal(5,2)
# Five in total , Integer bits, three bits , Two decimal places
create table if not exists t_money(
id int not null primary key auto_increment,
money decimal(5,2)
);
select * from t_money;
create table t_student(
sid int not null primary key auto_increment comment ' Student number ',
sname varchar(20) not null comment ' The student's name ',
idcard varchar(18) not null comment ' ID number ',
sex char(1) default '1' comment ' Student gender ,1= male ,0= Woman ',
createdate timestamp default current_timestamp comment ' Date of creation ',
unique(sname,idcard)
)comment ' Student information sheet ';
create table t_score(
sid int not null comment ' Student number ',
cid int not null comment ' Course number ',
score float default 0 comment ' achievement ',
foreign key(sid) references t_student(sid)
)comment ' Student transcript ';
# Delete the appearance first , Delete the main table
insert into t_score(sid,cid,score) values(1,2,90.5);
select * from t_student;
select * from t_score;This is today's sharing !
边栏推荐
- com.fasterxml.jackson.databind.exc.MismatchedInputException: Expected array or string. at [Source:x
- CPU的异常处理
- CH423要如何使用,便宜的国产IO扩展芯片
- 07 | 工作流设计:如何设计合理的多人开发模式?
- com. fasterxml. jackson. databind. exc.MismatchedInputException: Expected array or string. at [Source:x
- 解决u8glib只显示一行文字或者不显示的问题
- 网上开通证券账户安全吗 手机炒股靠谱吗
- 记录一次换行符引起的bug
- Technical dry goods | what is a big model? Oversized model? Foundation Model?
- 【UVM实战 ===> Episode_3 】~ Assertion、Sequence、Property
猜你喜欢

Super hard core! Can the family photo album on Huawei's smart screen be classified automatically and accurately?

如何把老式键盘转换成USB键盘并且自己编程?

2022年地理信息系统与遥感专业就业前景与升学高校排名选择

ArcGIS 镶嵌数据集切片丢失问题处理

Moher College - SQL injection vulnerability test (error reporting and blind note)

Flink 实战问题(七):No Watermark(Watermarks are only available EventTime is used)

用代码生成流程图,Markdown的使用方法

Lwip之定时机制

Central Limit Theorem

深度学习方法求解平均场博弈论问题
随机推荐
网上开通证券账户安全吗 手机炒股靠谱吗
Moher College - SQL injection vulnerability test (error reporting and blind note)
XML learning notes
2022 Health Expo, Shandong health care exhibition, postpartum health and sleep health exhibition
One click acceleration of Sony camera SD card file copy operation, file operation batch processing tutorial
05 | 規範設計(下):commit 信息風格迥异、難以閱讀,如何規範?
test
About Random Numbers
Flink 实战问题(七):No Watermark(Watermarks are only available EventTime is used)
Sword finger offer 10- ii Frog jumping on steps
Processing of slice loss in ArcGIS mosaic dataset
统一结果集的封装
Employment prospect of GIS and remote sensing specialty and ranking selection of universities in 2022
Is it safe to open a securities account online? Is it reliable to speculate in stocks by mobile phone
Law of Large Numbers
Flink practical problems (VII): no watermark (watermarks are only available eventtime is used)
JS library for number formatting
kubeadm创建kubernetes集群
ArcGIS 镶嵌数据集切片丢失问题处理
解决u8glib只显示一行文字或者不显示的问题