欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

数据库-----用户设置 数据修改

程序员文章站 2022-04-17 15:53:37
...

1.用户设置:

用户:使用程序的人

权限:被允许操作的范围

组:针对用户的权限集合,角色

 

设置用户密码:

set password for [email protected]ocalhost=password("1111")

查看用户名密码:

SELECT USER,host from mysql.user;

2.数据修改

表: alter table +旧表名 rename +新表名

修改表名:(将表student 改名为students)

alert table student rename student;

字段:

添加字段:   alter table +表名 add column+ 要添加的字段 + 数据类型

alter table students add column phone char(30);

删除字段: alter table +表名 drop column +要删除的字段

alter table students drop column phone;

修改字段类型:alter table+表名 modify column +字段+要修改的类型

alter table students modify column name char(32);

修改字段名称的类型:alter table +表名 chage column 旧字段名 +新字段名 +数据类型

alter table students change column name names char(32);

修改字段中的value: update 表名 set +要修改的字段和value

update students set names="张三",where id=1;

如果没有where改表中的所用names值

删除数据: delete from 表名

delete from students where id=1;

 

相关标签: 数据修改