Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MySQL5.7 under Windows system

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Below to bring you about the Windows system how to install MySQL5.7 content, I believe you must have read a similar article. What's the difference between what we bring to everyone? Let's take a look at the text. I believe you will gain something after reading how to install MySQL5.7 under the Windows system.

1. Check and uninstall the original version

We can check our system service to see if MySQL has been installed. There are two ways to open Windows system service:

Right-click my computer / computer, click Management, open computer Management, and then select Services and applications-Services. Use the shortcut command: press the win+ r key at the same time, and type services.msc in the run window to open the service.

After opening the system service page below, you can see that MySQL has been installed on my computer. I will uninstall it below. If your computer does not have MySQL service, you do not need to do this step.

Now let's open the cmd command line to uninstall MySQL:

Stop the MySQL service

Uninstall MySQL

two。 Download the MySQL installation package

Download address:

Https://downloads.mysql.com/archives/community/

Select the 5.7.23 Windows version to download

3. Extract the installation package and configure environment variables

Put the compressed package on a suitable disk for decompression. I put it on the E disk here. After decompression, it is recommended to rename the folder to mysql5.7.23.

It is recommended to configure the following environment variables before installation:

Right-click my computer / computer, click Properties, open Advanced system Settings, and click the environment variable.

Variable name: MYSQL_HOME

Variable value: e:\ mysql5.7.23

Add:% MYSQL_HOME%\ bin to path

4. Create data directories and configuration files

This version of MySQL does not create a data directory or my.ini. Create a data directory under the MYSQL_HOME directory. It is recommended that you set the data directory to E:\ mysql5.7.23\ data. In addition, create the Uploads directory as the directory for MySQL import and export. My.ini is recommended to put it under the MYSQL_HOME directory. For simple configuration, please see:

[mysqld] port=3306character_set_server=utf8basedir=E:\ mysql5.7.23datadir=E:\ mysql5.7.23\ dataserver-id=1sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONlower_case_table_names=1innodb_file_per_table = 1log_timestamps=SYSTEMlog-error = error.logslow_query_log = 1slow_query_log_file = slow.loglong_query_time = 5log-bin = binlogbinlog_format = 15log_bin_trust_function_creators = 1secure-file-priv=E:\ mysql5.7.23\ uploads [client] default-character-set=utf8

When we're done, our directory structure looks like this.

5. Initialize the database

The cmd command line goes to the E:\ mysql5.7.23\ bin directory and executes mysqld-- initialize-insecure

After execution, a lot of files are generated in the data directory.

6. Register and start the MySQL service

Execute the mysqld-install MySQL57 installation service (install is followed by the name of the service, here we use MySQL57 as the service name of the mysql5.7) net start MySQL57 starts the MySQL service.

7. Log in and change the password

To remind you, due to initialization settings or version differences, some versions are installed after the root is empty password, some are temporary passwords, we need to check the error log log prompt.

Open the error log and find that I have an empty password.

Let's log in on the command line and change the password:

If you need to configure root users to access remotely, you can execute the following statement:

Then we can log in with tools such as Navicat!

8. Backup script is included

Extra logical backup scripts are given. if you want to back up every day, you can add the script to the scheduled task and execute it regularly every day.

We can create a MySQLdata_Bak directory under E disk, and create a mysql_backup directory under this directory to store backup files. Mysql_bak.bat is a backup script. The script content is as follows (backup files from 7 days ago are automatically deleted):

Rem auther:wangrem date:20190526rem * MySQL backup start*@echo offforfiles / p "E:\ MySQLdata_Bak\ mysql_backup" / m backup_*.sql-d-7 / c "cmd / c del / f @ path" set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%"E:\ mysql5.7.23\ bin\ mysqldump"-uroot-p123456- P3306-- default-character-set=utf8-R-E-- single-transaction-- all-databases > "E:\ MySQLdata_Bak\ mysql_backup\ backup_%Ymd%.sql" @ echo onrem * MySQL backup end*

The overall directory structure is as follows, double-click to run the mysql_bak.bat script to back up all our databases.

For the above about how to install MySQL5.7 under the Windows system, do you think it is what you want? If you want to know more about it, you can continue to follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report