Tutorial on installing MySQL 5.7.18 decompressed version on Windows

Tutorial on installing MySQL 5.7.18 decompressed version on Windows

1. Installation process

MySQL version: 5.7.18

1. Configure the my.ini file (simple configuration) and put it in the root directory of MySQL. The file path configuration here needs to be an absolute path (backslashes need to be doubled, and one slash is enough) (the data folder does not need to be created by yourself, it will be generated later)

[client]
default-character-set=utf8
[mysqld]
port=3306
character_set_server=utf8
basedir="D:\\mysql-5.7.18-winx64"
datadir="D:\\mysql-5.7.18-winx64\\data"
# 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
[WinMySQLAdmin]
D:\\mysql-5.7.18-winx64\\bin\\mysqld.exe


2 Configure environment variables and configure the bin directory in Path

3 Initialize the database, generate the data folder and some configuration files in it (after initialization, the default password of the root account will be generated: in the xx.err file)

mysqld -initialize
# err file example:
[Note] A temporary password is generated for root@localhost: w1BI/g/y.wfx

4. Registration Service

mysqld -install

5 Start MySQL

net start mysql

6 After startup, log in and fill in the generated default password

mysql -uroot -p

7 Change the password of the account

set password for root@localhost=password('root');

8 Stop MySQL service

net stop mysql

9 If you want to delete the MySQL service, you can use the following command to delete it

mysqld -remove

2. Post-installation issues

ONLY_FULL_GROUP_BY question

Sometimes an error is reported after use:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'col_user_6.a.START_TIME' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Reason: MySQL has the only_full_group_by mode enabled by default. This mode can only obtain information about fields affected by the group by keyword, and cannot coexist with other fields not affected by the group by keyword. Alternatively, the group by field can only be placed at the first position of the select keyword. This is a limited solution:

1) Direct SQL solution: This solution has some limitations, that is, when the database is restarted, the only_full_group_by mode will still be started by default.

Copy the code as follows:
SET @@global.sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

2) Permanent solution: Add the following condition under [mysqld] in the my.ini file to filter out the only_full_group_by mode when MySQL is started:

Copy the code as follows:
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

Three control scripts

Finally, write a control script so that you can frequently use command operations when you use MySQL.

cls 
@echo off
:Set the window font color to color 0a 
:Set window title TITLE MySQL management program call :checkAdmin

goto menu
:Menu:menu
cls
echo. 
echo.=-=-=-=-Please select the operation you want to perform on MySQL-=-=-=-=-
echo.
echo.1: Start MySQL
echo.
echo.2: Close MySQL
echo. 
echo.3: Restart MySQL
echo. 
echo.4: exit echo.
echo.=-=-=-=-Please enter the project number you want to select↓-=-=-=-
set /p id=
if "%id%"=="1" goto startup
if "%id%"=="2" goto shutdown
if "%id%"=="3" goto reboot
if "%id%"=="4" exit
pause

:startup
echo.
call :checkMySQL 1
echo. Start MySQL......
net start "MySQL"
echo. MySQL started successfully!
pause 
goto menu 

:shutdown
echo.
call :checkMySQL 2
echo. Shut down MySQL......
net stop "MySQL"
echo. MySQL was shut down successfully!
pause 
goto menu

:reboot
echo.
call :checkMySQL 2
echo. Shut down MySQL......
net stop "MySQL"
echo. MySQL was shut down successfully!
goto startup
goto menu

:goout
pause
goto menu

: Check if the MySQL process exists: checkMySQL
set /a count=0
for /f "tokens=1 delims= " %%i in ('tasklist /nh ^| find /i "MySQL"') do (set /a count+=1)
if %count% neq 0 if "%1" equals "1" (
 echo warning: MySQL started goto goout
)
if %count% equal 0 if "%1" equal "2" (
 echo warning: MySQL not started goto goout
)

: Check if it is run as an administrator: checkAdmin
echo test am i admin? > %SystemRoot%\System32\admin.hujunjie
if not exist %SystemRoot%\System32\admin.hujunjie (
 echo Warning: Please run as administrator!
 pause
 exit
)
# The xxxx here can be set by yourself del %SystemRoot%\System32\admin.xxxx

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed tutorial on installing MySQL 5.7.19 decompressed version on Windows Server 2016
  • Install the unzipped version of MySQL on Windows 10 (recommended)
  • Installation and configuration of Mysql5.7.11 on windows10 (decompressed version)
  • How to install and uninstall MySQL service under Windows (MySQL 5.6 zip decompression version installation tutorial)
  • How to add MySQL to the system service under Windows system (mysql decompressed version)
  • Configuring and installing MySQL 5.6 decompressed version in Windows 7
  • Decompression, installation, backup and restore of MySQL under Windows environment

<<:  Docker large-scale project containerization transformation

>>:  How to monitor global variables in WeChat applet

Recommend

Mac+IDEA+Tomcat configuration steps

Table of contents 1. Download 2. Installation and...

Solution to the ineffective margin of div nested in HTML

Here's a solution to the problem where margin...

Practical explanation of editing files, saving and exiting in linux

How to save and exit after editing a file in Linu...

How to understand SELinux under Linux

Table of contents 1. Introduction to SELinux 2. B...

Implementation of Jenkins+Docker continuous integration

Table of contents 1. Introduction to Jenkins 2. I...

Detailed explanation of the difference between run/cmd/entrypoint in docker

In Dockerfile, run, cmd, and entrypoint can all b...

Detailed explanation of Mysql self-join query example

This article describes the Mysql self-join query....

CSS and HTML and front-end technology layer diagram

Front-end technology layer (The picture is a bit e...

WeChat applet development practical skills: data transmission and storage

Combining the various problems I encountered in m...

Solution to forgetting the MYSQL database password under MAC

Quick solution for forgetting MYSQL database pass...

Web standards learning to understand the separation of structure and presentation

When discussing Web standards, one thing that alwa...

Use Docker to build a Git image using the clone repository

Overview I have been using Docker for more than a...

Implementation of adding remark information to mysql

Preface Some people have asked me some MySQL note...

Solution to index failure caused by MySQL implicit type conversion

Table of contents question Reproduction Implicit ...

Alpine Docker image font problem solving operations

1. Run fonts, open the font folder, and find the ...