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

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

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

cd C:\Windows\system32   
net start mysql56

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

cd C:\Program Files\MySQL\MySQL Server 5.6\bin

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;

mysql 批处理文件--- 创建 用户 以及 导入数据的更多相关文章

  1. GeoMesa,整体架构,创建Schema并导入数据

    GeoMesa,整体架构,创建Schema并导入数据 一.GeoMesa-整体架构 二.GeoMesa-创建Schema并导入数据 2.1 GeoTools Data 模块 2.2 索引管理 2.3 ...

  2. Mysql:常用操作(导入数据,用户授权,远程连接授权,设置通信缓冲区的最大长度)

    1.导入数据命令: mysql --host=localhost --port=3306 --user=root --password=hnsjt_lwsj@2018 szyszx_20180515- ...

  3. 14 补充 MySQL的创建用户和授权

    权限管理 我们知道我们的最高权限管理者是root用户,它拥有着最高的权限操作.包括select.update.delete.update.grant等操作.那么一般情况在公司之后DBA工程师会创建一个 ...

  4. 使用Sqoop从mysql向hdfs或者hive导入数据时出现的一些错误

    1.原表没有设置主键,出现错误提示: ERROR tool.ImportTool: Error during import: No primary key could be found for tab ...

  5. mysql原理~创建用户的那些事情

    一 简介:mysql是如何创建用户的二 基本语法:  1 grant 权限 on db.table to 'user'@'ip' identified by 'password'     目的 创建用 ...

  6. MySQL中创建用户与授权

    参考地址:http://blog.csdn.net/gebitan505/article/details/51726649 一.创建用户(使用root用户登录进入mysql命令行) create us ...

  7. create和grant配合使用,对Mysql进行创建用户和对用户授权

    1.首先创建用户username以及密码passwd,授权主机localhost. create user ‘username’@'localhost' identified by 'passwd' ...

  8. oracle12建立非C##用户并且导入数据

    由于要导入dmp文件,所以想建立和oracle11一样的用户,折腾了半天,记录一下过程: 1.进入sqlplus,建立用户和分配权限 cmd>sqlplus /nolog SQL>conn ...

  9. MySQL数据库创建用户并实现远程登录

    创建用户 CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 2.授权 GRANT privileges_name privileges O ...

随机推荐

  1. Educational Codeforces Round 16 A

    Description he only king stands on the standard chess board. You are given his position in format &q ...

  2. #pragma 的使用

    #pragma 的使用 尽管 C 和 C++ 都已经有标准,但是几乎每个编译器 (广义,包含连接器等) 扩展一些 C/C++ 关键字. 合理地应用这些关键字,有时候能使我们的工作非常方便.下面随便说说 ...

  3. Oracle-学习笔记(==》集合函数与分组四)

    -- 聚集函数 配合分组语句 group by-- 显示最高分SELECT MAX(sscore) FROM db.`student`;-- 显示最高分学生的信息min maxSELECT * FRO ...

  4. linux硬盘分区格式化及挂载

    1.硬盘的接口类型 硬盘的接口一般分为两种,一种是IDE并行接口,一种是SATA串行接口, 在linux上面IDE接口的硬盘被识别为/dev/hd[a-z]这样的设备,其中hdc表示光驱设备,这是因为 ...

  5. C89标准库函数手册(待整理)

    http://zh.cppreference.com/w/c 前言 ANSI C(C89)标准库函数共有15个头文件.这15个头文件分别为: 1.<assert.h>            ...

  6. [C语言](*p)++与 ++(*p)与 *p++ 与 ++*p

    首先亮明个人观点,不要认为这样写都算写的不好,还强调大神一般不写这种代码,可读性不高 其实是你的C语言基础太差,读不懂,大神还真的就是这么写的.可以看看C语言库函数中的一些写法 *P++ :*和++都 ...

  7. 13. 用Roberts、Sobel、Prewitt和Laplace算子对一幅灰度图像进行边缘检测。观察异同。

    #include <opencv2/opencv.hpp> #include<opencv2/highgui/highgui.hpp> #include<opencv2/ ...

  8. (1)定义一个接口CanFly,描述会飞的方法public void fly(); (2)分别定义类飞机和鸟,实现CanFly接口。 (3)定义一个测试类,测试飞机和鸟,在main方法中创建飞机对象和鸟对象, 再定义一个makeFly()方法,其中让会飞的事物飞。并在main方法中调用该方法, 让飞机和鸟起飞。

    package b; public interface CanFly { public void fly(); } package b; public class FeiJi implements C ...

  9. Java_你应该知道的26种设计模式

    四. 模板方法模式 Definition: Define the skeleton of an algorithm in an operation, deferring some steps to s ...

  10. XShell 安装与虚拟机连接

    XShell:是liunx的远程管理工具 为啥要用这个工具呢?因为在古老的liunx字符命令下,是看不到中文的,要么使用liunx的图形化界面(支持中文),要么使用远程管理工具,是在windows中的 ...