"SQL" MySQL starts in Windows environment

Source: Internet
Author: User

Different versions of SQL are different in Windows environment Boot configuration method, here only the configuration method of 5.7.20 is introduced;

1, login to the MySQL official website download the tool compression package in Windows environment

The http://dev.mysql.com/downloads/mysql/PC is a 64-bit machine, so here's a demonstration of choosing the following version

2. Unzip to the local computer directory

3. Configure Environment variables

New system variable Mysql_home , the value is your MySQL directory for example: D:\tool\mysql-5.7.20-winx64

PATH environment variable added:%mysql_home%\bin; Note the front plus semicolon;

4. initialize the database to get the data directory

Go to cmd command line, execute mysqld--initialize-insecure

5. New My-default.ini file under Tools directory , pay attention to the directory replacement cost machine actual directory

# installation directory   = d:\\tool\\mysql-5.7.20-winx64  #= d:\\tool\\mysql-5.7.20-winx64\\ Data   #= 3306

6. Registering Windows Services

Go to cmd command line (using admin mode), execute mysqld-install

7. Start the MySQL service (admin mode)

cmd command line execution net start MySQL

8. Login Database Change Password

Mysql-u root-p

Set password = password (' new password ');

9. Stop

net stop MySQL

9. Import a ready-made script, log in to MySQL, run the SQL script via the source command, or, of course, a row of SQL statements.

1 DROP DATABASE IF EXISTSSampleDb;2 CREATE DATABASESampleDbDEFAULT CHARACTER SETUTF8;3  UseSampleDb;4 5 # #创建用户表6 CREATE TABLET_user (7    user_id   INTAuto_incrementPRIMARY KEY,8    user_name VARCHAR( -),9PasswordVARCHAR( +),TenCreditsINT, OneLast_visitdatetime, ALast_ipVARCHAR( at) -) ENGINE=InnoDB; -  the # #创建用户登录日志表 - CREATE TABLET_login_log ( -login_log_idINTAuto_incrementPRIMARY KEY, -    user_id   INT, +IpVARCHAR( at), -Login_datetimedatetime +) ENGINE=InnoDB; A  at # #插入初始化数据 - INSERT  intoT_user (user_name, password) -              VALUES('Admin','123456'); - COMMIT;

10. View Database Status

Of course, you can also use tools to view directly, such as Navicat Premium (can be connected to multiple types of databases, Oracle,sqlite,sql Server,mysql, etc.)

"SQL" MySQL starts in Windows environment

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.