Win install MySQL5.7.0+ services

0、Get installation package

1、Add the My.ini file to the bin directory. The contents are as follows

[mysql]
# Set MySQL client default character setdefault-character-set=utf8
[mysqld]
#Set 3306 portsPort= 3306
# Set up MySQL installation directoryBasedir=D:\mysql-5.7.23-win32
# Storage directory for setting up MySQL databaseDataDir=D:\mysql-5.7.23-win32\data
# Maximum number of connections allowedMax_connections=200
# The character set used by the server is defaults to the 8 bit coded Latin1 character set.Character-set-server=utf8
# Default storage engine that will be used when creating new tablesdefault-storage-engine=INNODB

2、Install and start MySQL

#Access to root directoryC:\Windows\System32>d:
#Access to bin directoryD:\>cd item\mysql-3306\bin
Install mysqld servicesD:\item\mysql-3306\bin>mysqld install
Run mysqldD:\item\mysql-3306\bin>mysqld  --initialize
mysql startD:\item\mysql-3306\bin>net start mysql

3、Get a password

Find the *.err file below “D:\item\mysql-3306\data”. The red box has the default password.

(Initializing database mysqld – initialize – user=root – console)

3、Login and set password

D:\item\mysql-3306\bin>mysql -u root -p #LandEnter password:****** #Enter default passwordWelcome to the MySQL monitor. Commands end with or \g.Your MySQL connectionid is 9
Server version: 5.7.23 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('huanu'); #Set the passwordQuery OK,0 rows affected, 1 warning (0.00 sec)

mysql>

 

Leave a Reply

Your email address will not be published. Required fields are marked *