Steps to initialize the password after the first successful installation of MySQL

Steps to initialize the password after the first successful installation of MySQL

Unzip the file into a directory

This is the directory after decompression

Enter the my.ini file

Double-click to open my.ini

Find these two lines and change them to your own decompression path and save

Right click on this computer properties

Find the advanced system settings configuration environment variables

Environment variables The new variable value is the path to the unzipped file

Path Click path to edit

New

Then open cmd as an administrator and enter the file path

Open a command line window and enter: mysqld --install

This command is used to install the service. After execution, a prompt will appear in English saying "success". You can now see the MySQL service in your Windows services. The command to remove the service is: mysqld remove

Then enter:

mysqld --initialize --console

This step is performed because there is no data folder in MySQL 5.7. You need to use these commands to generate a data folder and initialize a random login password.

After the execution, a large amount of English text will appear. It doesn't matter if you don't understand it. At the end, you will see a [email protected]: followed by a series of alphanumeric characters. This is the random password that MySQL automatically generates for you. Remember to write it down. root is the login username. We will use it when we log in to the MySQL database later (or just press enter to enter).

Start mysql service

After installation, you can only use it if you start the mysql service.

Command line input:

net start mysql

Change the default password

Previously, the randomly generated password of the system could only be used to log in, and then change the password, and could not be used with mysql. It could only be used after changing the password.

After starting the mysql service

Command line input: mysql -u root –p

Then you will be prompted to enter the password, which is the password generated before

A successful login is shown in the figure above. Enter the following commands in sequence:

use mysql; 
update user set authentication_string = password ("newpassword") where user = "root"; 
flush privileges;

At this point, MySQL has been fully installed and configured and can be used directly. As shown in the figure, you can view the original databases.

Command to stop the service: exit

After that, log in to MySQL again and enter the modified password to enter

Errors and precautions during installation

When I start the MySQL service after successful installation, the service fails to start, prompting: The MySQL service cannot be started. The service did not report any errors. Please type NET HELPMSG 3534 for more help, as follows:

Solution: After installing MySQL, open the cmd command window and enter the bin directory in the MySQL installation directory.

Then enter the following command and press Enter:

mysqld --initialize-insecure --user=mysql

After executing the above command, MySQL will create a data folder and build the default database.

The login username is root and the password is blank. Then you can start the MySQL service through the command net start mysql.

Note: There is no data folder when MySQL is upgraded to version 5.7. Executing the mysqld --initialize-insecure --user=mysql command will automatically create a new data folder.

The above is all the knowledge points for successful MySQL installation and successful initialization of password operations for the first installation. Thank you for your reading and support for 123WORDPRESS.COM.

You may also be interested in:
  • PHP+MySQL implements login verification to see if the login name and password are correct
  • 4 ways to modify MySQL root password (summary)
  • Solve the problem of changing the password when logging in for the first time after installing MySQL 8.0
  • MySQL 8.0.15 installation and configuration graphic tutorial and password change under Linux
  • Several solutions for forgetting the MySQL password
  • Complete steps to configure and install phpMyAdmin in CentOs 7.*
  • How to install and configure phpMyAdmin under centos
  • CentOS7 LNMP+phpmyadmin environment construction Part 3 phpmyadmin installation
  • Tutorial on installing phpMyAdmin on CentOS
  • Solution to the error of accessing phpmyadmin from newly installed XAMPP
  • phpmyadmin3 installation and configuration graphic tutorial
  • When installing phpmyadmin, I get the following error message: Warning: require_once (./libraries/common.inc.php)
  • How to install and configure phpMyAdmin in a virtual host
  • How to install PHPMYAdmin in win2008 IIS7
  • Ubuntu View and modify mysql login name and password, install phpmyadmin

<<:  Use Angular CDK to implement a Service pop-up Toast component function

>>:  Detailed explanation of hosts file configuration on Linux server

Recommend

DHCP Configuration Tutorial in CentOS7 Environment

Table of contents Configuration command steps in ...

How to use Docker containers to implement proxy forwarding and data backup

Preface When we deploy applications to servers as...

An article to understand the usage of typeof in js

Table of contents Base Return Type String and Boo...

Vue implements Modal component based on Teleport

Table of contents 1. Get to know Teleport 2. Basi...

A brief introduction to Linux environment variable files

In the Linux system, environment variables can be...

Tips to prevent others from saving as my web page and copying my site

Nowadays, copying websites is very common on the I...

Ubuntu boot auto-start service settings

How to create a service and auto-start it in Ubun...

SQL fuzzy query report: ORA-00909: invalid number of parameters solution

When using Oracle database for fuzzy query, The c...

Analysis of the process of building a cluster environment with Apache and Tomcat

In fact, it is not difficult to build an Apache c...

SpringBoot integrates Activiti7 implementation code

After the official release of Activiti7, it has f...