Learn MySQL with teacher Wang: configure MySQL

Source: Internet
Author: User
Tags mysql connect

Learn MySQL with teacher Wang: Configure MySQL Teacher: Wang Shaohua QQ Group: 483773664 Learning Content

Learn to configure a free-to-install version of MySQL


I. Configuring the environment variable path

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M00/83/7F/wKioL1d0s4ewrCxHAAAtTLeUixU142.png "alt = "Wkiol1d0s4ewrcxhaaattleuixu142.png"/>

Test whether the configuration was successful

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M00/83/80/wKiom1d0s4eCe7NRAABFtdqOeU4827.png "alt = "Wkiom1d0s4ece7nraabftdqoeu4827.png"/>

Second, modify the configuration file

Configuration file name: My-default.ini

Path: D:\mysql-5.7.13

What to set: Character encoding, MySQL directory, database directory, port number

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21st

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

# *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the

# *** default location during install, and will be replaced if you

# *** upgrade to a newer version of MySQL.

[client]

 default-character-set=utf8

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

# These are commonly set, remove the # and set as required.

# basedir mysql所在目录

  basedir = D:\mysql-5.7.13

#datadir 数据库存放的位置 data目录没有,不能自己创建

  datadir = D:\mysql-5.7.13\data

# port 服务端口,默认是3306

  port = 3306

# server_id = .....

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Third, initialize MySQL database table

You must open Cmd.exe as an administrator

Initialize the data directory first. If the MySQL service cannot be started without this step, the error MySQL service cannot start.

1

D:\mysql-5.7.13\bin>mysqld --initialize

Need to wait for a while, after the execution completes, will automatically generate a data directory, this directory also has the MySQL to bring the database

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M01/83/7F/wKioL1d0s4fx_JiQAACEZG5nPFk418.png "alt = "Wkiol1d0s4fx_jiqaacezg5npfk418.png"/>

Iv. registering MySQL with Windows system services

You must open Cmd.exe as an administrator

1. Increase Service

1

2

D:\mysql-5.7.13\bin>mysqld install mysql

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M01/83/80/wKiom1d0s4ew8oIHAAAFlqkB01I167.png "alt = "Wkiom1d0s4ew8oihaaaflqkb01i167.png"/>

Note: MySQL is the service name, you can also call other names, such as MySQL install mysql111, then the removal service and boot (close) must be mysql111

2. Remove Service Command

1

D:\mysql-5.7.13\bin>mysqld remove mysql

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M02/83/7F/wKioL1d0s4fwQiLWAAAFcmjuHUQ996.png "alt = "Wkiol1d0s4fwqilwaaafcmjuhuq996.png"/>

V. Start and close MySQL

Startup: net start MySQL

Close: net stop MySQL

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M02/83/80/wKiom1d0s4jBxSMoAAAQNAwoZPg940.png "alt = "Wkiom1d0s4jbxsmoaaaqnawozpg940.png"/>

Six, change the root account password 1 initial password

The initial password was generated at the time of the mysqld--initialize command,

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M00/83/7F/wKioL1d0s4jzlVQwAAA2qPIGEOs536.png "alt = "Wkiol1d0s4jzlvqwaaa2qpigeos536.png" in/> file

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M00/83/80/wKiom1d0s4njTmaEAAE5IPrJX0E376.png "alt = "Wkiom1d0s4njtmaeaae5iprjx0e376.png"/>

The generated passwords are all 12-bit passwords for various characters

2. Update initialization password

After logging into MySQL, you must change the default password, otherwise report the following error

650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M01/83/7F/wKioL1d0s4mC0PAiAAAKFCaVgEA593.png "alt = "Wkiol1d0s4mc0paiaaakfcavgea593.png"/>

Method:


650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M01/83/80/wKiom1d0s4mwnJzqAAAKLYORVQA642.png "alt = "Wkiom1d0s4mwnjzqaaaklyorvqa642.png"/>


Vii. Remote Login Configuration


Allow the root user to remotely log in anywhere and have any permissions to operate on any library, as follows:

1) Log in to MySQL first using the root user:

Command line execution: Mysql-u root-p

Enter password

2) Authorize the operation:

Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;

Overload Authorization Table:

Mysql>flush privileges;

Exit Mysql:quit


650) this.width=650; "border=" 0 "src=" http://s3.51cto.com/wyfs02/M02/83/7F/wKioL1d0s4nT7p8TAAARUHZNuSA594.png "alt = "Wkiol1d0s4nt7p8taaaruhznusa594.png"/>

Viii. commands for Telnet 1 MySQL connect to local database

User name "root", password "123456" (Note: "-P" and "123456" can not have space between)

Mysql-h Localhost-u root-p123456

2 MySQL Connection remote database (192.168.0.201)

Port "3306", username "root", password "123456"


Mysql-h 192.168.0.201-p 3306-u root-p123456


Nine, on-machine practice

Download, install, and configure a free-to-install MySQL

Ten, teaching video

Http://edu.51cto.com/course/course_id-6395.html


This article is from "Learn programming with Mr. Wang" blog, please be sure to keep this source http://teacherwang.blog.51cto.com/10946447/1794528

Learn MySQL with teacher Wang: configure MySQL

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.