Mysql5.7.18 how to install and modify the initial password, mysql change the initial password

Source: Internet
Author: User

Mysql5.7.18 how to install and modify the initial password, mysql change the initial password

For how to install MySQL in Centos, refer to the previous article.

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

There are two ways to install mysql5.7 in windows:

1. Download The. msi Installation File and install it as prompted on the page.
2. Download The. biz compressed package

Here we will introduce the second method for installing the compressed version.

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

1. Download mysql

Other Versions

Https://dev.mysql.com/downloads/mysql/

2. Install mysql

The compressed package is equivalent to a no-Installation File. to use it, you only need to configure relevant parameters and then start the Database Service through the service.

2.1 decompress the package to your desired location

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

2.2 create the my. ini file

Create the my. ini file in the mysql-5.7.18-winx64 root directory to add the following:

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

Note that basedir and datadir must be configured. basedir is the directory you extract

2.3 configure Environment Variables

Add a variable named 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 to enter the bin directory of mysql.
2. initialize database files

mysqld --initialize

After the initialization is successful, some files are generated under the datadir directory. The temporary password for the root account is described in the xxx. err (xxx is the name of your computer user) file. Example: <r8j * Qrh) jdp is the temporary password of 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 the mysql Service

mysqld -install MySQL 

2.6 start the mysql Service

net start MySQL 

3. Modify the root password

Log On with 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 -- initializeD: \ software \ mysql-5.7.18-winx64 \ bin> D: \ software \ mysql-5.7.18-winx64 \ bin> mysqld-install MySQLD: \ software \ mysql-5.7.18-winx64 \ bin> net start MySQLMySQL service is starting .... the MySQL service has been started successfully. D: \ software \ mysql-5.7.18-winx64 \ bin> mysql-uroot-pEnter password: ************ Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 3 Server version: 5.7.18Copyright (c) 2000,201 7, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners. 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> exitBye

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

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.