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

Analysis of the project process in idea packaging and uploading to cloud service

one. First of all, you have to package it in idea...

How does Vue implement communication between components?

Table of contents 1. Communication between father...

Several techniques for playing sounds with CSS

CSS is the realm of style, layout, and presentati...

Docker data management and network communication usage

You can install Docker and perform simple operati...

Introduction to HTML DOM_PowerNode Java Academy

What is DOM? With JavaScript, you can reconstruct...

VUE + OPENLAYERS achieves real-time positioning function

Table of contents Preface 1. Define label style 2...

Illustration of the process of using FileZilla to connect to the FTP server

When I first started setting up an ftp server on ...

Vue realizes the whole process of slider drag verification function

Rendering Define the skeleton, write HTML and CSS...

Analyze how to automatically generate Vue component documentation

Table of contents 1. Current situation 2. Communi...

Key features of InnoDB - insert cache, write twice, adaptive hash index details

The key features of the InnoDB storage engine inc...

Example code of implementing starry sky animation with CSS3 advanced LESS

This article introduces the sample code of advanc...

mysql uses stored procedures to implement tree node acquisition method

As shown in the figure: Table Data For such a tre...