mysql5.7.17 installation and configuration example on win2008R2 64-bit system

mysql5.7.17 installation and configuration example on win2008R2 64-bit system

123WORDPRESS.COM has explained to you the installation process of other versions of MYSQL in various environments. You can refer to the related articles below the text. Today, let’s learn the example installation tutorial of MySQL 5.7.17. The configuration is slightly different. I hope it can help you.

Install MySql

Operating system: Windows Server 2008 R2 Standard

MySql version: mysql-5.7.17-winx64

Step 1: Unzip mysql-5.7.17-winx64.zip to the specified location

Step 2: Add a data folder to the root directory of the installation file and rename my-default.ini to my.ini

Step 3: Enter the following commands in sequence at the command prompt:

Note: If you have installed it before, to uninstall the service, use the command: mysqld -remove

Execute the following commands in sequence:

cd C:\mysql-5.7.17-winx64\bin

mysqld --initialize (note there is only one space between mysqld and --)

mysqld --install

Since it has been installed before, uninstall the service first, then execute the installation command

Step 4: Modify the my.ini file, add a line of skip-grant-tables under [mysqld], and then execute

Start the mysql service: net start mysql

Enter MySql:mysql

Set password: update mysql.user set authentication_string = password('cnki2017') where `User` = 'root'; (Note the semicolon. Note that after copying the command, you may need to adjust the input method and then re-enter it)

Note: Setting the password can be divided into two steps:

use mysql;

update user set authentication_string=password("cnki2017") where user="root";

Refresh MySQL system privilege related tables: flush privileges; (note the semicolon)

Exit MySql: exit; (note the semicolon)

Stop the MySQL service: net stop mysql

Step 5: Delete the skip-grant-tables added previously in the my.ini file, and then execute the following commands in sequence:

Start the mysql service: net start mysql

Enter mysql:mysql -uroot -pcnki2017

Reset password: set password=password('cnki2017'); (note the semicolon)

Allow any IP to log in: update mysql.user set host = '%' where user = 'root' limit 1; (note the semicolon)

Refresh MySQL system privilege related tables: flush privileges; (note the semicolon)

Exit MySql: exit (optional)

Step 6: Configuration

Character set configuration: Execute the following commands in sequence

cd C:\mysql-5.7.17-winx64\bin

mysql -uroot -pcnki2017

show variables like 'character%';

set Variable_name=utf8;

Where Variable_name can be replaced with the corresponding name. For example, if Variable_name is character_set_database, then the command is: set character_set_database=utf8;

Even after setting the above command 5.7 does not work

To add the following to my.ini:

[mysqld]

character-set-server=utf8

[client]

default-character-set=utf8

Set the default engine

[mysqld]

default-storage-engine=INNODB

Note:

To create a new user, execute the following commands in sequence:

mysql -uroot -pcnki2017

create user username@'%' identified by 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

flush privileges;

In the above command, username and password are the username and password to be created.

Master-slave replication

Operating system: Windows Server 2008 R2 Standard

MySql version: mysql-5.7.17-winx64

Main ip:192.168.107.13

From ip:192.168.107.73

Configuring the Master

The first step is to configure my.ini and then restart the server

server-id=1

log-bin=mysql-bin

binlog-do-db=hy_webapi

Meaning analysis:

server-id: The unique identification id of the server, a unique number.

log-bin: Specifies to enable binary logging.

binlog-do-db: the database to be synchronized between master and slave

Step 2 Authorization

Command prompt operation

Cd to the bin directory: cd C:\mysql-5.7.17-winx64\bin

Enter mySql: mysql -uroot -pcnki2017

Execute the show command: show master status; record the above File and Position.

Enable master-slave replication user: GRANT REPLICATION SLAVE ON *.* to 'root'@'192.168.107.73'identified by cnki2017; (note the semicolon)

Note: You can specify other accounts for the slave instead of using the root account, provided that the account is created first.

Configuring the slave server

The first step is to configure my.ini and then restart the server

server-id =2

replicate-do-db=hy_webapi

relay-log-index=slave-relay-bin.index

relay-log=slave-relay-bin

in:

relay-log: defines the location and name of relay_log

relay-log-index: index file of relay log

Step 2 Authorization

Command prompt operation

Cd to the bin directory: cd C:\mysql-5.7.17-winx64\bin

Enter mySql: mysql -uroot -pcnki2017

Set permissions: change master to master_host='192.168.107.13',master_user='root',master_password='cnki2017',master_log_file='mysql-bin.000001',master_log_pos=154;

Start the slave library: start slave;

View information: show slave status \G;

Note: When setting permissions here, you can assign them to other accounts of the main database instead of using the root account, provided that that account is created first.

You may also be interested in:
  • Detailed tutorial on configuration method of Mysql 5.7.19 free installation version (64-bit)
  • Installation tutorial of MySQL 5.7 green version under windows2008 64-bit system
  • Tutorial on installing the green version of mysql-5.7.16-winx64 on 64-bit win10 system
  • How to install MySQL 5.7.11 on 64-bit Win10 system (case study)
  • MySQL 5.7.31 64-bit free installation version tutorial diagram

<<:  Simple steps to create a MySQL container with Docker

>>:  JavaScript design pattern learning adapter pattern

Recommend

Detailed explanation of how to view MySQL memory usage

Preface This article mainly introduces the releva...

Detailed explanation of how to pass password to ssh/scp command in bash script

Install SSHPASS For most recent operating systems...

jQuery implements the bouncing ball game

This article shares the specific code of jQuery t...

MySQL 5.7.20 compressed version download and installation simple tutorial

1. Download address: http://dev.mysql.com/downloa...

Understanding MySQL clustered indexes and how clustered indexes grow

In this note, we briefly describe What is the B+T...

MySQL executes commands for external sql script files

Table of contents 1. Create a sql script file con...

How to connect to MySQL remotely through Navicat

Using Navicat directly to connect via IP will rep...

Summary of 10 amazing tricks of Element-UI

Table of contents el-scrollbar scroll bar el-uplo...

Key knowledge summary of Vue development guide

Table of contents Overview 0. JavaScript and Web ...

The whole process of node.js using express to automatically build the project

1. Install the express library and generator Open...

Installation of mysql-community-server. 5.7.18-1.el6 under centos 6.5

Use the following command to check whether MySQL ...

Nodejs module system source code analysis

Table of contents Overview CommonJS Specification...

Detailed tutorial for installing MySQL on Linux

MySQL downloads for all platforms are available a...

Implementation of nginx worker process loop

After the worker process is started, it will firs...

Detailed explanation of the this pointing problem in JavaScript

Summarize Global environment ➡️ window Normal fun...