MySQL工作中的实际用_工作中 mysql 常用的命令

Insert into qhs_timeline(time,info,detail) select time,info,detail from qhs_timeline;

三、 show create table  eye_21.order_func

describe       table eye_21.order_func

6207c9b361ac71cf2269a57afcd2b2ad.png

四、建表语句

建表语句

CREATE TABLE `en_orders_93` (

`Id` bigint(20) NOT NULL AUTO_INCREMENT,

`parentId` bigint(20) DEFAULT NULL, `

orderType` int(11) DEFAULT NULL,

`createDate` datetime DEFAULT NULL,

`completeDate` datetime DEFAULT NULL,

`state` int(11) DEFAULT NULL, `yn` tinyint(3) DEFAULT NULL, `splitType` int(11) DEFAULT NULL, `sendPay` varchar(800) DEFAULT NULL, `pin` varchar(300) DEFAULT NULL COMMENT 'pin', `customerName` varchar(300) DEFAULT NULL COMMENT 'customerName', `mobile` varchar(50) DEFAULT NULL, `phone` varchar(50) DEFAULT NULL, `customerEmail` varchar(100) DEFAULT NULL, `paymentType` int(11) DEFAULT NULL, `shipmentType` int(11) DEFAULT NULL, `zip` varchar(50) DEFAULT NULL, `province` int(11) DEFAULT NULL, `city` int(11) DEFAULT NULL, `county` int(11) DEFAULT NULL, `town` int(11) DEFAULT NULL, `address` varchar(2000) DEFAULT NULL COMMENT 'address', `expectPickDate` datetime DEFAULT NULL, `userLevel` varchar(255) DEFAULT NULL, `customerIp` varchar(100) DEFAULT NULL, `partnerId` int(11) DEFAULT NULL, `remark` text,

`weight` decimal(18,4) DEFAULT NULL,

`volume` decimal(18,4) DEFAULT NULL,

PRIMARY KEY (`Id`) ) ENGINE=InnoDB

AUTO_INCREMENT=22373470

DEFAULT CHARSET=utf8

COMMENT='国际站订单详情表'

1:mysql导出数据库成为sql文件

mysqldump --opt --user=$dbuser --password=$dbpass --host=$dbhost $dbname > ~/backups/$sitename/$dbname.sql

2:导入数据库sql脚本

source D:\$dbname.sql

3:新建用户

GRANT ALL PRIVILEGES ON *.* TO cactiuser@'%' IDENTIFIED BY 'CactiMadeEZ';

drop user work@'%';

创建用户

GRANT ALL PRIVILEGES ON *.* TO cactiuser@'%' IDENTIFIED BY 'CactiMadeEZ';

drop user work@'%' 删除远程用户

关闭服务:

mysqladmin -u root -p root shutdown 关闭服务 启动服务:mysqld -uroot 或者mysqld --standalone --debug

命令:

在命令行中如果出现乱码:set names gbk

DESC 表名 查看表结构

外键:

1:1005错误的原因出现,大多数情况为,当前的外键

mysql: 的要求:作为外键的那列必须有一个索引(index) 否则就会出现建表不成功的情况。

:外键命名每个标的外键的名字必须不一样,否则也会出现1005错误,命名规则为:fk_当前表_目标表

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值