MySQL Batch file---Create Users and import data

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.