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
At the very beginning, let's talk about what ...
All previous projects were deployed in the Window...
1. Download VMware Workstation 64 version https:/...
Table of contents Listener watch Format Set up th...
<br />From the launch of NetEase's new h...
1. Elements and tags in HTML <br />An eleme...
1. Concat function. Commonly used connection stri...
Table of contents 1. Basic event handling 2. Send...
Table of contents Vue3 encapsulation message prom...
CSS Sprite, also known as CSS Sprite, is an image...
1. Introduction People who are not used to Englis...
Table of contents 1. Installation 2. Import into ...
Preface Regarding the use of MySQL indexes, we ha...
This article shares the download, installation an...
This article shares a sharing sidebar implemented...