环境
搭建一个mysql源码的数据库
主机192.168.80.100 主机名db
https://blog.youkuaiyun.com/qeeezz11224/article/details/85093094 //地址搭建数据库过程
第一步
进入数据库操作
mysql -uroot -pabc123 //进入数据库
show databases; //查看所有数据库
create database c01; //创建数据库c01
use c01; //切换数据库
create table stu (name char(16),password int(48)); //创建stu表字段为name,password
show tables; //查看表
desc stu; //查看表中结构字段
insert into stu (name,password) values ('张三','123'); //给表stu表添加内容
select * from stu; //查看表中内容
update stu set password=789 where name='张三'; //将表中的张三用户密码有原来的123改为789
select * from stu; //查看密码已经修改成功
delete from stu where name='张三'; //删除stu表中张三用户
delete from stu; //删除表中所有数据
select * from stu; //查看表stu会发现表中内容为空
drop table stu; //删除数据表stu
drop database c01; //删除数据库c01
alter table stu rename stu1; //修改表明为stu1
alter table stu1 add "身份证" int(24)NOT NULL; //在表stu1中添加身份证字段
alter table stu1 change "身份证" "班级" char(10) NOT NULL; //将stu1表中的字段身份证改为班级
alter table stu1 drop "密码"; //删除stu1表中的密码字段
到此数据库中的增删改查基本命令完成
root!QAZ2wsx
root@localhost : MYSQL 04:40:05> set PASSWORD=PASSWORD('123456');
Query OK, 0 rows affected, 1 warning (0.01 sec)
Warning (Code 1287): 'SET PASSWORD = PASSWORD('<plaintext_password>')' is deprecated and will be removed in a future release. Please use SET PASSWORD = '<plaintext_password>' instead
update user set authentication_string=password('123456') where user='aml';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
Warning (Code 1681): 'PASSWORD' is deprecated and will be removed in a future release.
root@localhost : mysql 04:45:48> flush privileges;
show create table mysql.user; 查看建表语句