zoukankan      html  css  js  c++  java
  • mysql 批处理文件--- 创建 用户 以及 导入数据

    在window下,通过批处理文件(.bat),进行开启MYSQL服务,导入数据文件(.sql)

    1)新建一个txt文件,写入以下内容

    rem 启动mysql56服务  mysql56是我的mysql服务名称  若该服务已启动,则下面2行代码可省略

    cd C:Windowssystem32   
    net start mysql56

    rem 进入安装目录的路径下 C:Program FilesMySQLMySQL Server 5.6in  执行以下代码    数据库文件mysql_create.sql 位置在  C:/Users/huamao/Desktop

    cd C:Program FilesMySQLMySQL Server 5.6in

    mysql -hlocalhost -uroot -phuamao33587 < C:/Users/huamao/Desktop/mysql_create.sql

    mysql -hlocalhost -uroot -phuamao33587

    2)另存为后缀名为 .bat 的文件  点击即可自动执行

    顺便附上我的mysql_create.sql中的内容,(mysql_create.sql也是由.txt 另存为.sql生成的)

    --创建用户密码并授权,最后建了2张表


    create database pumberrinfo; 

    create user wuyun11 identified by '123456';

    grant all privileges on pumberrinfo6.* to wuyun11 identified by '123456';

    flush privileges;


    use pumberrinfo;

    create table hisRunInfo
    (NumID bigint not null auto_increment primary key,

    IP varchar(15),
    CANID int unsigned not null,
    MType char(4),

    OperMode char(6),
    OperState char(6),
    Out1_Mode char(6),

    Out1_State char(6),
    Out2_Mode char(6),
    Out2_State char(6),

    Out3_Mode char(6),
    Out3_State char(6),

    Freq_IValue float unsigned,
    QFlow float(13,2) unsigned,
    Accum float(13,2) unsigned,
    Total double (20,2)unsigned,

    Time char(20)

    )default charset=utf8 auto_increment=1;

    create table errinfo
    (NumID bigint not null auto_increment primary key,
    IP varchar(15),
    CANID int unsigned not null,
    errType char(15) not null,
    errRank char(4),
    errTime char(20),
    errDescribe varchar(30) default "null")default charset=utf8 auto_increment=1;

  • 相关阅读:
    BZOJ2298: [HAOI2011]problem a
    BZOJ4066: 简单题
    BZOJ2131: 免费的馅饼
    Educational Codeforces Round 97 div2
    [SCOI2016]背单词
    [SCOI2015]情报传递(离线树状数组跑图)
    树上主席树(无代码,单纯谈思路的一篇水文)
    CF Round #679 div2赛后总结
    [SCOI2015]小凸解密码(平衡树、线段树做法)
    CF Round #677 div3 赛后总结
  • 原文地址:https://www.cnblogs.com/wuyun-blog/p/4444758.html
Copyright © 2011-2022 走看看