MySQL installation is successful and the first installation successfully initializes the password operation

Extract a file to a directory

This is the unzipped directory

 

Include 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 this computer properties

 

 

Find Advanced System Settings Configure Environment Variables

 

 

 

Environment variable The value of the new variable is the path to the decompressed file

 

 

Path Click path to edit

 

 

 

 

new

 

Then open cmd as administrator and enter the file path

 

 

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

 

 

This command is to install the service. After execution, it will prompt the success of English. At this time, you can see the MySQL service in your windows service. 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 the data folder and initialize the random login password.

 

After the execution, a large piece of English will appear. It doesn’t matter if you don’t understand it. At the end, you see a root@localhost: followed by a series of alphanumeric symbols. This is a random password that MySQL automatically generates for you. To remember, root is the login The username, we will use it when we log in to the MySQL database later (or press enter directly to enter)

 

4. Start the mysql service

After installation, it can only be used when the mysql service is started.

Command line input: net start mysql

 

 

5. Modify the default password

The password randomly generated by the system can only be used to log in, and then change the password, you can't use mysql, you can only use it after you change it

After starting the mysql service

Command line input: mysql -u root -p

 

 

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

 

The login is successful as shown above, enter the following commands in turn:

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

 

So far, mysql has all been installed and configured, you can use it directly, as shown in the figure, you can view the original databases.

Command to stop the service: exit

Then log in to mysql again and enter the modified password directly to enter.

 

6. Errors and precautions in the installation process

          When I start the MySQL service after the installation is successful, the service cannot be started, and the prompt: MySQL service cannot be started The service does 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 create a default database.

   The login user name is root and the password is empty. After that, 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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325214721&siteId=291194637