MySQL命令

1 连接mysql命令:mysql -u root -p

2 查看存储引擎: show engines;

3 显示database:show databases;

4 连接database:use db01;

5 显示表信息:show create table payment;

6 直接指定存储引擎:create table table(id int) engine=innoDB;

7 创建外键:ALTER TABLE payment ADD CONSTRAINT product_id_fk FOREIGN KEY(product_id) REFERENCES product(product_id)

8 创建索引:ALTER TABLE payment ADD INDEX payment_serial_index ( payment_serial );  SHOW INDEX FROM payment;

 

posted @ 2022-12-05 12:17  NingShare  阅读(25)  评论(0编辑  收藏  举报