1. Download MySQL 1. Log in to the official website of MySQL and download the ZIP compressed package for 64-bit system (https://dev.mysql.com/downloads/mysql/) 2. Unzip the installation package Unzip the downloaded ZIP archive to any folder. (Here: C:\mysql5.7) 3. Modify the configuration file Rename the my-default.ini file in the unzipped folder to my.ini. Open it with a text editor and clear its contents. Added content (reference Internet): [mysql] # Set the default character set of the mysql client to default-character-set=utf8 [mysqld] #Set port 3306 port = 3306 # Set the installation directory of mysql to basedir=C:\mysql5.7 # Set the storage directory of mysql database data datadir=C:\mysql5.7\data # Maximum number of connections allowed max_connections=200 # The default character set used by the server is the 8-bit latin1 character set character-set-server=utf8 # The default storage engine that will be used when creating a new table default-storage-engine=INNODB Note: Replace basedir and datadir with your actual paths. The folder directory after the initial decompression of the compressed package of MySQL version 5.7 does not contain a data folder. Don't worry, it will be initialized and created using commands later. No manual creation is required here. After the modification is completed, save and exit. 4. Configure environment variables Add C:\mysql5.7\bin to the Path environment variable (replace it with the actual path of the bin directory) Note: Separate from the previous environment variables with ; 5. Install MySQL Run the cmd window as administrator. Switch to the C:/mysql5.7/bin directory Enter the following commands in order: 1. mysqld install waits for the prompt that the installation is successful 2. mysqld --initialize initializes the data directory 3. net start mysql to start the service 6. Change the root user's password After completing the above five steps, run mysql -u root -p. Since the root user has no password by default, just press Enter to enter. Error message: ERROR 1045 (28000): Access denied for user'root'@'localhost'(using password: NO) This is because the mysql root user has not set a password. We need to temporarily ignore the permissions and set the root user's password. Here’s how to do it: Add a line of statement skip_grant_tables under the [mysqld] entry in the configuration file my.ini Save and exit, and restart the MySQL service. If you do not restart the MySQL service, there will be no effect. After restarting, run mysql -u root -p When prompted to enter the password, just press Enter to enter MySQL Enter the following SQL statements in order 1.use mysql; show Database changed Delete or comment out skip_grant_tables in the configuration file my.ini 7. Some settings for first login You cannot use MySQL directly after logging in for the first time. You need to reset your password again, otherwise an error message will appear. ERROR 1820 (HY000) : You must SET PASSWORD before executing this statement Enter the command: set password=password('123456'); Keep the same password as set in the previous step After the settings are completed, MySQL can be used normally. At this time, the root user can only connect through the local computer, which is sufficient for learning. If you need a remote connection, you need to set it up again The SQL statement is as follows: use mysql; show tables; select host,user from user; update user set host='%' where user='root'; quit net stop mysql net start mysql Note: The host column specifies the IP address that the user is allowed to log in through. % is a wildcard. If it is set to %, any IP address can access the root account. The above is the detailed steps for installing and configuring MySQL 5.7 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Talk about important subdirectory issues in Linux system
This article example shares the specific implemen...
There are two types of web page box models: 1: Sta...
This article shares the MySQL 5.7.16 free install...
Preface If you are going to interview for a Linux...
This article shares with you how to use Vue to im...
Some people say that doing advertising is like bei...
Table of contents Examples from real life Slow qu...
There are very complex HTML structures in web pag...
1. Docker network management 1. Docker container ...
Table of contents Objectives for this period 1. F...
Elasticsearch is very popular now, and many compa...
Data Type: The basic rules that define what data ...
Click on the anchor link to scroll smoothly and a...
Table of contents Preface 1. Use global unified o...
This article shares the specific code for impleme...