在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. Unity GUI内绘制贝塞尔曲线

    用Handles可以直接在GUI下绘制贝塞尔 using UnityEditor; using UnityEngine; using System.Collections; public class ...

  2. ural 1104,暴力取模

    题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1104 题目大意:输入一个字符串(数字与大写字母组成),输出n,n满足此字符串为n进制时, ...

  3. thinkphp 实现无限极分类

    thinkphp实现无限极分类,获得所有的子类 今天学习测试了一上午也没有整出来,一开始一直没有办法把所有的子分类拿出来. 最后找到原因: 每次调用的时候没有在最后return的位置我没有选择retu ...

  4. Python 字符串、元组、字典转换成列表

  5. BZOJ 3550 Vacation(最小费用最大流)

    题目链接:http://www.lydsy.com:808/JudgeOnline/problem.php?id=3550 题意:给出3×n个数字,从中选出一些数字,要求每连续的n个数字中选出的数字个 ...

  6. js写个日历

    其实我是一个对时间和日期不怎么感兴趣的人,小学的时候感觉时间或者日期那块就让我很晕,因为有时候是100进制有时候是60进制,搞的我对日历一直很不感兴趣,最近不知道为什么想写一个日历了,可想而知,这个玩 ...

  7. CUBRID学习笔记 11 数据类型之日期

    datetime 虽然和mysql很相像,但是日期类型和mysql是不一样的.和sqlserver差不多. 如YYYY-MM-DD hh:mi:ss.fff or mm/dd/yyyy hh:mi:s ...

  8. 虚拟机guest为windows7的环境下安装破解版simplify3d_3.0.2

    情形: 1.主机(host):ubuntu 2.虚拟机里安装的操作系统版本(guest):windows 7专业版 3.simplify3d破解版版本:3.0.2(破解需要的工具均在下文的百度云地址里 ...

  9. POJ 3253 Fence Repair(修篱笆)

    POJ 3253 Fence Repair(修篱笆) Time Limit: 2000MS   Memory Limit: 65536K [Description] [题目描述] Farmer Joh ...

  10. python_way day17 jQuery表单验证,事件绑定,插件,文本框架,正则表达式

    python_way day17 1.jQuery表单验证 dom事件绑定 jquery事件绑定 $.each return值的判断 jquery扩展方法 2.前段插件 3.jDango文本框架 4. ...