MySQL 5.7.21 installation and password configuration tutorial

MySQL 5.7.21 installation and password configuration tutorial

MySQL5.7.21 installation and password setting tutorial, as follows

Official reference manual

1. Unzip the MySQL 5.7.20 installation package, such as X:\MySQL\mysql-5.7.21-winx64. (There is no data and my.ini)

2. Configure mysql environment variables, create MYSQL_HOME, and add %MYSQL_HOME%\bin to Path;

3. Configure my.ini. And put my.ini in the bin directory (1. If it is placed in the mysql-5.7.21-winx64 directory, the MYSQL service may not be started when executing net start mysql below, 2. data will not be automatically generated)

[client]
 
default-character-set=utf8
 [mysqld]
#Unzip directory such as: D:\MySQL\mysql-5.7.21-winx64
 basedir = %MYSQL_HOME% 
#Unzip directory such as: D:\MySQL\mysql-5.7.21-winx64\data
 datadir = %MYSQL_HOME%\data 
 port = 3306 
 default-character-set=utf8

4. Enter the command line as an administrator (you can find it by searching and typing cmd in Cortana), and enter the X:\MySQL\mysql-5.7.21-winx64\bin directory and enter the command: mysqld --initialize-insecure (generate a root user without a password). Then the data file will appear in the mysql-5.7.20-winx64 directory.

5. Enter mysqld --install again. If Service successfully installed appears, registration is successful.

Note: If this operation reports an error message "Install/Remove of the Service Denied!", it is recommended that you enter the command prompt as an administrator.


6. Start the MySQL service, command: net start mysql

7. Set the password mysqladmin -u root password password

8. Change the password as follows: Then enter mysql -uroot -p Since you have logged in before, just enter the password you just set (the first time you log in as root, you can enter directly without a password) MYSQL>

Then enter: update mysql.user set authentication_string=password('the password you want to enter') where user='root' and Host ='localhost'; Then enter: flush privileges;


9. Enter the command show databases; to view the data table

Commonly used MySQL commands are as follows

List of all MySQL commands: 
Note that all text commands must be first on line and end with ';' 
? (\?) Synonym for `help'. 
clear (\c) Clear the current input statement. 
connect (\r) Reconnect to the server. Optional arguments are db and host. 
delimiter (\d) Set statement delimiter. 
ego (\G) Send command to mysql server, display result vertically. 
exit (\q) Exit mysql. Same as quit. 
go (\g) Send command to mysql server. 
help (\h) Display this help. 
notee (\t) Don't write into outfile. 
print (\p) Print current command. 
prompt (\R) Change your mysql prompt. 


quit (\q) Quit mysql.

rehash (\#) Rebuild completion hash. 
source (\.) Execute an SQL script file. Takes a file name as an argument. 
status (\s) Get status information from the server. 
tee (\T) Set outfile [to_outfile]. Append everything into given outfile. 
use (\u) Use another database. Takes database name as argument. 
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. 
warnings (\W) Show warnings after every statement. 
nowarning (\w) Don't show warnings after every statement. 
resetconnection(\x) Clean session context.

10. Enter \q; to exit MySQL

11. Shut down the MySQL service, command: net stop mysql

Wonderful topic sharing: Installation tutorials for different versions of MySQL Installation tutorials for MySQL 5.7 versions Installation tutorials for MySQL 5.6 versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Solve the problem of forgetting password in MySQL 5.7 under Linux
  • Summary of how to modify the root password in MySQL 5.7 and MySQL 8.0
  • Tutorial on installing and changing the root password of MySQL 5.7.20 decompressed version
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • How to install and modify the initial password of mysql5.7.18
  • How to change password in MySQL 5.7.18
  • How to change the root password of Mysql5.7.10 on MAC
  • What to do if you forget the root password of Mysql5.7 (simple and effective method)
  • Mysql5.7.14 installation and configuration method operation graphic tutorial (password problem solution)
  • Detailed explanation of the solution to forget the password in MySQL 5.7

<<:  How to implement JavaScript's new operator yourself

>>:  Tutorial diagram of using Jenkins for automated deployment under Windows

Recommend

How to set a fixed IP in Linux (tested and effective)

First, open the virtual machine Open xshell5 to c...

Vue implements the browser-side code scanning function

background Not long ago, I made a function about ...

js to implement web calculator

How to make a simple web calculator using HTML, C...

In-depth understanding of Vue's data responsiveness

Table of contents 1. ES syntax getter and setter ...

The difference between JS pre-parsing and variable promotion in web interview

Table of contents What is pre-analysis? The diffe...

WeChat applet development chapter: pitfall record

Recently, I participated in the development of th...

How to use the EXPLAIN command in SQL

In daily work, we sometimes run slow queries to r...

Example of using mycat to implement MySQL database read-write separation

What is MyCAT A completely open source large data...

About the usage and precautions of promise in javascript (recommended)

1. Promise description Promise is a standard buil...

A brief discussion on MySQL select optimization solution

Table of contents Examples from real life Slow qu...

Analysis of the principle of Nginx using Lua module to implement WAF

Table of contents 1. Background of WAF 2. What is...

MySQL slow query optimization: the advantages of limit from theory and practice

Many times, we expect the query result to be at m...

A brief discussion on the characteristics of CSS float

This article introduces the characteristics of CS...

How to make a centos base image

Preface Now the operating system used by my compa...