首页 > 数据库技术 > 详细

mysql dos常用命令

时间:2020-06-20 10:28:27      阅读:64      评论:0      收藏:0      [点我收藏+]

net start mysql 连接数据库

mysql -u 用户名 -p 密码登陆

 create database 库名; //创建数据库
create table `student`(
     id int(20) primary key not null,
     name varchar(255),
     tid int(20));   //创表
 create table `teacher`(
     tid int(20),
     tname varchar(255));
 alter table  teacher add constaraint teacher_pk primary key teacher(tid); //添加主键
 alter table student add constaraint student_fk_teacher foreign key(tid) references teacher(tid); //添加外键
 alter table student rename stu; //更换表名
 alter table stu add age int(20); //添加字段
 alter table stu change age aihao varchar(20); //修改字段

 alter table stu drop aihao; //删除字段

mysql dos常用命令

原文:https://www.cnblogs.com/caiwei321/p/13167442.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!