Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Have explained to you the installation process of other versions of MYSQL in various environments, you can refer to the relevant articles below the text, today to learn the instance installation teaching of mysql5.7.17, 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: extract the mysql-5.7.17-winx64.zip to the specified location

Step 2: add the data folder under the root of the installation file, and rename my-default.ini to my.ini

Step 3: enter the following commands at the command prompt:

Note that if you have previously installed, to uninstall the service, use the command: mysqld-remove

Execute the following commands in turn:

Cd C:\ mysql-5.7.17-winx64\ bin

Mysqld-- initialize (notice that there is only a space between mysqld and--)

Mysqld-install

Since it has been installed before, uninstall the service first, and 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 you may have to adjust the input method after copying the command, and then re-enter it)

Note: you can set the password in two steps:

Use mysql

Update user set authentication_string=password ("cnki2017") where user= "root"

Refresh the system permission related table of MySQL: flush privileges; (note the semicolon)

Exit MySql:exit; (note semicolon)

Stop the Mysql service: net stop mysql

Step 5: delete the my.ini file and replace the previously added skip-grant-tables, and then execute the following command:

Start the mysql service: net start mysql

Enter mysql:mysql-uroot-pcnki2017

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

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

Refresh the system permission related table of MySQL: flush privileges; (note the semicolon)

Exit MySql:exit (can not have semicolons)

Step 6: configure

Character set configuration: execute the following commands in turn

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, the command is: set character_set_database=utf8

Even if the above command 5.7 is set, it will 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 command:

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

Master ip:192.168.107.13

From ip:192.168.107.73

Configuration Master (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

Interpretation of meaning:

Server-id: the server uniquely identifies the id, a unique number.

Log-bin: specifies that binary logging is enabled.

Binlog-do-db: the library to be synchronized between master and slave

Step 2 Authorization

Operate at the command prompt

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

Enter mySql:mysql-uroot-pcnki2017

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

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

Note: this can be assigned to other accounts from the library instead of using the root account, as long as that account is created first.

Configure 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

Where:

Relay-log: defines the location and name of the relay_log

Index file for relay-log-index:relay log

Step 2 Authorization

Operate at the command prompt

Cd to 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

Enable slave library: start slave

View information: show slave status\ G

Note: when setting permissions here, you can assign other accounts to the main database instead of using the root account, as long as you create that account first.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report