mysql学习笔记

1、mysql服务的启动和停止

net stop mysql80、net start mysql80

2、mysql服务登陆与退出

mysql 【-h localhost -P3306】 -u root -p

exit

3、数据库常用命令

show databases;(显示所有数据库)

use 数据库名;(选择数据库)

 show tables;  show tables from mysql;(显示数据库表)
 select database();(查看当前使用数据)
 create table stuinfo(id int,name varchar(20));(新建表)
show create table stuinfo;   desc stuinfo;(查看表结构)
select * from stuinfo;(查询表数据)
insert into stuinfo (id) values (1);   insert into stuinfo  values (1,'suan');(插入表数据)
 update stuinfo set name = 'lilei' where id = 1;(修改表数据)
 delete from stuinfo where id = 1;(删除表数据)
select version();(查询数据库版本)
create table temp1 (select name from stuinfo);(将查询数据存放到临时表)
4、查询数据库版本
mysql --version
posted @ 2022-09-14 18:23  xiaohong吖  阅读(14)  评论(0编辑  收藏  举报