mysql 导入sql脚本

C:\Users\Administrator>mysql -u root -p

Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

mysql> source e:\android_work\mstx.sql
Query OK, 7 rows affected (0.07 sec)
Query OK, 1 row affected (0.00 sec)
Database changed
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.02 sec)
mysql> quit
Bye

mstx.sql 内容

drop database mstx;
create database mstx;
use mstx;
create table mstx_head(          /*头像表*/

tid int NOT NULL,             /* 编号 */

tname varchar(50),            /* 头像的名称 */

tdis char(255),                /* 简单的描述 */

tdata blob,                    /*  图片的数据*/

uid int,                     /* 上传者ID */

ttime TIMESTAMP,           /* 上传时间 */

PRIMARY KEY(tid)           /* 设置主键 */

);

commit;

上一篇:shell中的括号

代码交流 2021