Under window, open the MySQL service with the batch file (. bat), import the data file (. sql)
1) Create a new TXT file and write the following content
rem Start mysql56 service mysql56 is my MySQL service name if the service is started, the following 2 lines of code can be omitted
CD C:\Windows\system32
net start mysql56
REM enters the installation directory under the path C:\Program files\mysql\mysql Server 5.6\bin executes the following code database file Mysql_create.sql location in 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) Save as file with suffix. bat and click to execute automatically
By the way, I enclose the contents of my Mysql_create.sql (Mysql_create.sql is also saved as. SQL generated by. txt)
--Create a user password and authorize it, and finally built 2 sheets
Create Database Pumberrinfo;
Create user wuyun11 identified by ' 123456 ';
Grant all privileges the 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 (a) is not NULL,
Errrank char (4),
Errtime Char (20),
Errdescribe varchar (+) default "null") default Charset=utf8 auto_increment=1;
MySQL Batch file---Create Users and import data