Error reporting of initialization temporary password after mysql8.0.11 is installed successfully

Error reporting of initialization temporary password after mysql8.0.11 is installed successfully

View mysql version number after successfully installing mysql 8.0.11

PS C:\WINDOWS\system32> mysql --version
C:\Software\mysql-8.0.11-winx64\bin\mysql.exe  Ver 8.0.11 for Win64 on x86_64 (MySQL Community Server - GPL)

Execute the initialization command mysqld --initialize --console to report an error

Open cmd as administrator and enter the bin directory of MySQL, execute the command mysqld --initialize --console
The mysqld --initialize --console command is used to initialize MySQL and get a temporary password.

PS C:\Software\mysql-8.0.11-winx64\bin> mysqld --initialize --console
2018-10-31T03:18:05.201142Z 0 [System] [MY-013169] [Server] C:\Software\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 2356
2018-10-31T03:18:05.231148Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2018-10-31T03:18:05.242682Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-10-31T03:18:05.251312Z 0 [System] [MY-010910] [Server] C:\Software\mysql-8.0.11-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.11)  MySQL Community Server - GPL.

Report error
[ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.

Causes and Solutions

There is data in the data folder of mysql installation directory, resulting in an error.

Function of data folder:
1. Store ibdata (all database information is here);
2. The folder where the database is stored. For example, if there is a database called teacher, there will be a folder where all files of the teacher database are stored.

Solution: empty the data folder.

Execute the command mysqld --initialize --console again

PS C:\Software\mysql-8.0.11-winx64\bin> mysqld --initialize --console
2018-10-31T03:24:15.995649Z 0 [System] [MY-013169] [Server] C:\Software\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 19760
2018-10-31T03:24:26.177747Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: #ld(EIl4XmA.
2018-10-31T03:24:31.063614Z 0 [System] [MY-013170] [Server] C:\Software\mysql-8.0.11-winx64\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed

Obtain the temporary password ා ld(EIl4XmA

Log in to MySQL with a temporary password and change the password

Enter the command mysql -u root -p

 PS C:\Software\mysql-8.0.11-winx64\bin> mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.11


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>

Enter SQL to modify password

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.12 sec)

Password modification succeeded!

Keywords: Database MySQL Oracle Windows

Added by KI114 on Tue, 10 Dec 2019 14:46:05 +0200