How to install and modify the initial password of mysql5.7.18

How to install and modify the initial password of mysql5.7.18

For Centos installation of MySQL, please refer to a previous article

Centos7.3 install Mysql5.7 and change the initial password

There are two ways to install MySQL 5.7 on Windows

1. Download the .msi installation file and install it directly according to the interface prompts
2. Download the .biz compressed file

Here we introduce the second compressed version installation method

Official reference document https://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html

1. Download MySQL

Other versions download address

https://dev.mysql.com/downloads/mysql/

2. Install MySQL

The compressed package is equivalent to an installation-free file. To use it, you only need to configure the relevant parameters and then start the database service through the service.

2.1 Unzip the compressed file to your preferred location

This example is unzipped to the folder D:\software\mysql-5.7.18-winx64

2.2 Create my.ini file

Create a my.ini file in the root directory of mysql-5.7.18-winx64 and add the following content:

[mysqld]
# set basedir to your installation path
basedir=D:\\software\\mysql-5.7.18-winx64
# set datadir to the location of your data directory
datadir=D:\\software\\mysql-5.7.18-winx64\\data
port = 3306
max_allowed_packet = 32M 

Note that basedir and datadir must be configured. basedir is the directory where you unzipped the files.

2.3 Configure environment variables

Add a variable called MYSQL_HOME.
Modify the Path variable and add %MYSQL_HOME%\bin at the end

2.4 Initialize database files

1. Run cmd as an administrator and enter the bin directory of mysql.
2. Initialize the database file

mysqld --initialize

After successful initialization, some files will be generated in the datadir directory. Among them, the xxx.err (xxx is the name of your computer user) file describes the temporary password of the root account. Example: <r8j*Qrh)jdp is the temporary password for the root account

2017-05-17T10:31:54.235041Z 1 [Note] A temporary password is generated for root@localhost: <r8j*Qrh)jdp

2.5 Register MySQL service

mysqld -install MySQL 

2.6 Start MySQL service

net start MySQL 

3. Change the root password

Log in using the root account

mysql -u root -p <r8j*Qrh)jdp

Change root password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

4. Installation log

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

D:\software\mysql-5.7.18-winx64\bin>mysqld --initialize

D:\software\mysql-5.7.18-winx64\bin>
D:\software\mysql-5.7.18-winx64\bin>mysqld -install MySQL

D:\software\mysql-5.7.18-winx64\bin>net start MySQL
MySQL service is starting....
The MySQL service has been started successfully.


D:\software\mysql-5.7.18-winx64\bin>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18

Copyright (c) 2000, 2017, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Solve the problem of forgetting password in MySQL 5.7 under Linux
  • Summary of how to modify the root password in MySQL 5.7 and MySQL 8.0
  • Tutorial on installing and changing the root password of MySQL 5.7.20 decompressed version
  • MySQL 5.7.21 installation and password configuration tutorial
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • How to change password in MySQL 5.7.18
  • How to change the root password of Mysql5.7.10 on MAC
  • What to do if you forget the root password of Mysql5.7 (simple and effective method)
  • Mysql5.7.14 installation and configuration method operation graphic tutorial (password problem solution)
  • Detailed explanation of the solution to forget the password in MySQL 5.7

<<:  React State state and life cycle implementation method

>>:  Docker container deployment attempt - multi-container communication (node+mongoDB+nginx)

Recommend

Example of how to install nginx to a specified directory

Due to company requirements, two nginx servers in...

Implementation of code optimization for Vue2.x project performance optimization

Table of contents 1 Use of v-if and v-show 2. Dif...

How to use Docker Swarm to build WordPress

cause I once set up WordPress on Vultr, but for w...

Summary of xhtml block level tags

* address - address * blockquote - block quote * c...

Use Python to connect to MySQL database using the pymysql module

Install pymysql pip install pymysql 2|0Using pymy...

Teach you how to insert 1 million records into MySQL in 6 seconds

1. Idea It only took 6 seconds to insert 1,000,00...

Detailed explanation of pipeline and valve in tomcat pipeline mode

Preface In a relatively complex large system, if ...

vsCode generates vue templates with one click

1. Use the shortcut Ctrl + Shift + P to call out ...

Implementing user registration function with js

This article example shares the specific code of ...

How to elegantly implement the mobile login and registration module in vue3

Table of contents Preface Input box component lay...

How to use Spark and Scala to analyze Apache access logs

Install First you need to install Java and Scala,...

HTML insert image example (html add image)

Inserting images into HTML requires HTML tags to ...

Understand CSS3 Grid layout in 10 minutes

Basic Introduction In the previous article, we in...