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 MySQL 5.7.25 on Windows platform

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to install MySQL 5.7.25 on the Windows platform. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

1. Directory planning, directory name, parameter name, path address, installation directory, basedirE:\ mysql\ data temporary file directory, tmpdirE:\ mysql\ datasocket file directory, socketE:\ mysql\ data\ mysql.sockbin log file directory, log_binE:\ mysql\ log\ mysql-bin.logrelay log file directory, relay_logE:\ mysql\ log\ mysql-relay.log2. MySQL 5.7download

Currently, GA of the MySQL community provides downloads of 5 and 8.

Since most systems still use version 5 at present

The version of 5 is used here.

[MySQL Community Server 5.7.25] (https://dev.mysql.com/downloads/mysql/)

3. Create a new directory

Create new data and log directories under the E:\ mysql directory

After the download is complete, copy the file to the E:\ mysql directory

Be careful not to put the upper directory of the MySQL installation file into the

The final directory structure is shown in the figure

4. Establish a configuration file

The windows version of MySQL first reads the my.ini file in the C disk and directory, then my.cnf, and finally in the directory of% WINDIR%.

Of course, we can specify manually at startup.

We set up c:\ my.ini here

[mysql] user = password = [mysqld] #-MySQL Basic Setting-#server-id = 1723161113port = 3306user = mysqlpid-file = mysql.pidcharacter_set_server = utf8mb4default_storage_engine = InnoDBskip_name_resolve = 1explicit_defaults_for_timestamp = 1open_files_limit = 65535max_connections = 1000max_connect_errors = 100000basedir = E:\\ mysqldatadir = E:\\ mysql\\ datatmpdir = E:\\ mysql\\ datasocket = E:\\ mysql\\ data\\ mysql.sockquery_cache_type = query_cache_size = join_buffer_size = 64Mtmp_table_size = 64Mmax_allowed_packet = 32Mread_buffer_size = 16Mread_rnd_buffer_size = 32Msort_buffer_size = 32M#-MySQL Log Setting-#log _ error = mysql-error.loglog_bin = E:\\ mysql\\ log\\ mysql-bin.logslow_query_log_file = mysql-slow.logrelay_log = E:\\ mysql\\ log\\ mysql-relay.loglog_slave_updates = 1sync_binlog = 1relay_log_recovery = 1binlog_format = rowexpire_logs_days = 14slow_query_log = 1long_query_time = 2log_queries_not_using_indexes = 1log_throttle_queries_not_using_indexes = 10 logbooks Statements = 1log_slow_slave_statements = 1min_examined_row_limit = 1000#-MySQL Replication Setting-#slave_skip_errors = ddl_exist_errorsmaster_info_repository = TABLErelay_log_info_repository = TABLEgtid_mode = onenforce_gtid_consistency = 1binlog_rows_query_log_events = 1mm- -MySQL InnoDB Setting-#innodb_page_size = 16384innodb_buffer_pool_size = 1024Minnodb_data_file_path = ibdata1:1G:autoextendinnodb_buffer_pool_instances = 8innodb_file_per_table = 1innodb_buffer_pool_load_at_startup = 1innodb_buffer_pool_dump_at_shutdown = 1innodb_flush_log_at_trx_commit = 1innodb_lock_wait_timeout = 5innodb_io_capacity = 800innodb Max = 2000#innodb_flush_method = O_DIRECTinnodb_file_format = Barracudainnodb_file_format_max = Barracudainnodb_undo_logs = 128innodb_undo_tablespaces = 3innodb_flush_neighbors = 1innodb_log_file_size = 2Ginnodb_log_buffer_size = 16777216innodb_print_all_deadlocks = 1innodb_strict_mode = 1innodb_sort_buffer_size = 67108864#skip-grant-tables=1#-MySQL semi Replication Setting- -# # plugin_dir = / usr/local/mysql/lib/plugin#plugin_load = "rpl_semi_sync_master=semisync_master.so Rpl_semi_sync_slave=semisync_slave.so "# loose_rpl_semi_sync_master_enabled = 1#loose_rpl_semi_sync_slave_enabled = 1#loose_rpl_semi_sync_master_timeout = 5000

Note that I copied the parameters of the linux platform here to ensure normal initialization.

The innodb_flush_method parameter needs to be commented out because the O_DIRECT method is not supported.

The path requires two backslashes

5. Initialize the database

Next we initialize the MySQL

Open powershell with administrator privileges (cmd is also available)

E:\ mysql\ bin\ mysqld-- initialize-- console

The password will be generated automatically after initialization. Please remember him.

After initialization, the data and log directories will have corresponding files.

6. Add MySQL to the service

E:\ mysql\ bin\ mysqld-- install

At this point, we can start and stop the database using windows service.

Add the MySQL bin directory to the PATH environment variable

Remember to reopen the command window after modification

7. Connect to the database

Use the following command to connect

Mysql-uroot-ppassword

If the following error is reported, please uncomment the skip-grant-tables in the configuration file and restart it

MySQL Host':: 1'or '127.0.0.1' is not allowed to connect to this MySQL server

The update user table is fine.

SQL > UPDATE mysql.user SET host='%' WHERE user='root'

SQL > flush privileges

8. Start and stop database

We can either start or stop the database using the windows service

You can also use the following command

Shut down the database

Mysqladmin-uroot-p shutdown

Administrator privileges are required

Net stop mysql

Open the database

Administrator privileges are required

Net start mysql

This is the end of the article on "how to install MySQL 5.7.25 on the Windows platform". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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