MySQL configuration installs mysql-5.7.18-winx64.zip

Keywords: MySQL Database Windows

Download and other preparatory work is not said, by default you have downloaded, and decompression completed.  

Since MySQL version 5.7.18, my.ini or my-default.ini is no longer available in MySQL zip installation package, which also has some obstacles for installers. So first, share my-default.ini file of MySQL's past version mysql-5.6.36-winx64.zip.

Note that don't modify my-default.ini!!!

Create a new. INI file and add your own configuration. The official point is my.ini, and then share it, with Chinese comments.

1. Save the following code into the decompressed mysql-5.7.18-winx64 root directory, named my-default.ini

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

2. Then still create a my.ini file in the mysql-5.7.18-winx64 root directory, as follows

[mysql-ini-self]
# Keep in mind that there must be no fewer characters on the top and that the characters on the inside should not be in the four forms on the bottom.
# [mysql],[client],[mysql ],[client ]
# It's okay to test the following by yourself. You know it by analogy.
# [],[ mysql],[ client],[m ysql],[clie nt]
# Too much, delete what you don't like.

# Set 3306 as port number
port=3306

[client]
# Setting the default character set of the database
default-character-set=utf8

[mysqld]
# Creating new tables will use the default storage engine
default-storage-engine=INNODB
# Server uses character sets
character-set-server=utf8
collation-server=utf8_general_ci

# Setting up MySQL installation directory
basedir=E:\allocation_resource\mysql-5.7.18-winx64
# Setting up MySQL database data storage directory
datadir=E:\allocation_resource\mysql-5.7.18-winx64\data

# Permissible maximum number of connections
max_connections=200

# Open Query Cache
explicit_defaults_for_timestamp=true

2.1 Pay attention to three points:

  1. basedir: MySQL installation directory
  2. datadir: Store MySQL data directory, which requires you to create your own data folder (data name customization)
  3. Port: No explanation, port number, generally 3306

2.2 Attachment: Attention is paid to these locations.

         

3. When the files above are ready, the installation can begin.

  1. First, as an administrator, run C: Windows System32 cmd.exe, or black window.
  2. Enter decompressed directory to run instructions
    mysqld --install
  3. Set MySQL database password to null
    mysqld --initialize-insecure --user=mysql
    There are also random password generators, you have to find, directly generate empty bar; remember to wait patiently for a while, and when it completely responds, you will see a lot of files in the custom data folder.
  4. Start MySQL Service
    net start mysql
  5. Log in to the database (remember the current password is empty)
    mysql -uroot -p

    You are then asked to enter your password and enter the database directly by return.

  6. Modify database password
    set password for root@localhost = password('root');
  7. Try re-entering the database
    mysql -uroot -proot

    You can install the database.

4. Error, reinstallation

4.1 After the mysql service on the local computer starts and stops, some services will automatically stop when they are not used by other services or programs.

  • Uninstall command: mysqld --remove mysql (it also deletes services synchronously, very convenient)
  • Delete all files under the data folder (remember it's indispensable)

Posted by timc37 on Sun, 23 Jun 2019 17:24:59 -0700