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

How to deploy Vue project under nginx

Today I will use the server nginx, and I also nee...

Detailed explanation of basic interaction of javascript

Table of contents 1. How to obtain elements Get i...

Analysis of slow insert cases caused by large transactions in MySQL

【question】 The INSERT statement is one of the mos...

JavaScript Advanced Custom Exception

Table of contents 1. Concept 1.1 What are errors ...

js implements a simple shopping cart module

This article example shares the specific code of ...

Table setting background image cannot be 100% displayed solution

The following situations were discovered during d...

8 tips for Vue that you will learn after reading it

1. Always use :key in v-for Using the key attribu...

Problems and solutions when installing and using VMware

The virtual machine is in use or cannot be connec...

Example of automatic stop effect after text scrolling

The effect is very simple, just copy the following...

How to use axios to make network requests in React Native

In front-end development, there are many ways to ...

Markup Language - Image Replacement

Click here to return to the 123WORDPRESS.COM HTML ...

Solution to Linux QT Kit missing and Version empty problem

Currently encountering such a problem My situatio...

How to Delete Junk Files in Linux Elegantly

I wonder if you are like me, a programmer who arr...

Node.js solves the problem of Chinese garbled characters in client request data

Node.js solves the problem of Chinese garbled cha...