MySQL0002:命令行操作数据库常用命令

1,

命令行操作数据库:

  登录
 C:\Users\Administrator>d:

D:\>cd D:\wamp\mysql\bin
D:\wamp\mysql\bin>mysql
mysql -hlocalhost -uroot -p


设置
set names gbk;
show databases;
use esun;


建表
CREATE TABLE IF NOT EXISTS `wxapp`(
    `mid` int not null auto_increment primary key, #ID
    `mnum` varchar(32) not null,
    `mtitle` varchar(32) not null,
    `mdes` text not null,
    `mlist` varchar(32) not null,
    `murl` varchar(120) not null,
    `mimg` varchar(120) not null,
    `mtime` varchar(32) not null,
    `mendtime` varchar(32) not null,
    `mendurl` varchar(32) not null,
    `mcheck1` varchar(32) not null,
    `mcheck2` varchar(32) not null
    )ENGINE=MyISAM DEFAULT CHARSET=utf8;

ENGINE=InnoDB;
ENGINE=MyISAM DEFAULT CHARSET=utf8;


CRUD操作
DROP TABLE phonenum;
DELETE FROM `wxapp` WHERE `wxapp`.`id` = 3;
SELECT * FROM `wxapp`;


插入数据
INSERT INTO `wxapp`(mid,mnum,mtitle,mdes,mlist,murl,mimg,mtime,mendtime,mendurl,mcheck1,mcheck2) VALUES(NULL,
    ‘0003‘,
    ‘平度文物3‘,
    ‘平度文物三维讲解3‘,
    ‘wenwu‘,
    ‘https://oss.esunar.com/ESUN3D/PinDuWenWu/Home/index.html‘,
    ‘https://www.esun3dai.com/WxAppRes/data/image/classify/share0001.png‘,
    ‘20200919‘,
    ‘0‘,
    ‘0‘,
    ‘0‘,
    ‘0‘
    );

 

MySQL0002:命令行操作数据库常用命令

上一篇:vue el-select 设置默认值后选项无法切换


下一篇:DBUnit备份数据库,表,数据还原