Home Database Mysql Tutorial Tutorial on how to install the decompressed version of MySQL5.7.18 under Windows

Tutorial on how to install the decompressed version of MySQL5.7.18 under Windows

Jul 26, 2017 pm 03:40 PM
windows Unzip

这篇文章主要为大家详细介绍了Windows安装MySQL 5.7.18 解压版的详细教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

一、安装过程

MySQL 版本:5.7.18

1 、配置my.ini文件(简单的配置),放到MySQL的根目录下,此处的文件路径配置需要为绝对路径(使用反斜杠需要双拼,斜杠一个就可以了)(data文件夹不用自己创建,后面生成)


[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"
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
[WinMySQLAdmin]
D:\\mysql-5.7.18-winx64\\bin\\mysqld.exe
Copy after login


2 配置环境变量,在Path中配置bin目录

3 初始化数据库,生成data文件夹以及其中的一些配置文件(初始化后会生成root账户的默认密码:在xx.err文件中)


mysqld -initialize
# err文件示例:
[Note] A temporary password is generated for root@localhost: w1BI/g/y.wfx
Copy after login

4 注册服务


mysqld -install
Copy after login

5 启动MySQL


net start mysql
Copy after login

6 启动后登录,填入生成的默认密码


mysql -uroot -p
Copy after login

7 修改账户的密码


set password for root@localhost=password('root');
Copy after login

8 停止MySQL服务


net stop mysql
Copy after login

9 若想删除MySQL服务,可以是有下面命令删除


mysqld -remove
Copy after login

二、安装后问题

ONLY_FULL_GROUP_BY 问题

使用后有时会报错:

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
Copy after login

原因:MySQL 默认开启了only_full_group_by模式,这个只能获取受到group by影响的字段信息,不能与其它没有受到group by影响的字段共存,或者是只能将group by的字段放到select关键字的首位,这个是有局限的
解决方案:

1)直接sql解决:这个解决方案有点局限性,就是数据库重启的时候还是会默认启动only_full_group_by模式

复制代码 代码如下:

SET @@global.sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_pISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
Copy after login

2)永久性解决:在my.ini文件[mysqld]下,添加以下条件,这样在MySQL启动的时候将only_full_group_by模式过滤掉了

复制代码 代码如下:

sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_pISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
Copy after login

三 控制脚本

最后写一个控制脚本,这样就可以在自己使用MySQL的时候频繁的使用命令操作了


cls 
@echo off
:设置窗口字体颜色
color 0a 
:设置窗口标题
TITLE MySQL管理程序

call :checkAdmin

goto menu
:菜单
:menu
cls
echo. 
echo.=-=-=-=-请选择您要对MySQL的操作-=-=-=-=-
echo.
echo.1: 启动MySQL
echo.
echo.2: 关闭MySQL
echo. 
echo.3: 重启MySQL
echo. 
echo.4: 退 出
echo.
echo.=-=-=-=-请输入您要选择的项目序号↓-=-=-=-
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.启动MySQL......
net start "MySQL"
echo.启动MySQL成功!
pause 
goto menu 

:停止
:shutdown
echo.
call :checkMySQL 2
echo.关闭MySQL......
net stop "MySQL"
echo.关闭MySQL成功!
pause 
goto menu

:重启
:reboot
echo.
call :checkMySQL 2
echo.关闭MySQL......
net stop "MySQL"
echo.关闭MySQL成功!
goto startup
goto menu

:退出
:goout
pause
goto menu

:检查MySQL进程是否存在
: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" equ "1" (
 echo 警告:MySQL已启动
 goto goout
)
if %count% equ 0 if "%1" equ "2" (
 echo 警告:MySQL未启动
 goto goout
)

:检查是否是以管理员身份运行
:checkAdmin
echo test am i admin? > %SystemRoot%\System32\admin.hujunjie
if not exist %SystemRoot%\System32\admin.hujunjie (
 echo 警告:请以管理员身份运行!
 pause
 exit
)
# 这里的xxxx可以自己设定
del %SystemRoot%\System32\admin.xxxx
Copy after login

The above is the detailed content of Tutorial on how to install the decompressed version of MySQL5.7.18 under Windows. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1252
24
How to copy and paste mysql How to copy and paste mysql Apr 08, 2025 pm 07:18 PM

Copy and paste in MySQL includes the following steps: select the data, copy with Ctrl C (Windows) or Cmd C (Mac); right-click at the target location, select Paste or use Ctrl V (Windows) or Cmd V (Mac); the copied data is inserted into the target location, or replace existing data (depending on whether the data already exists at the target location).

Can vs code run in Windows 8 Can vs code run in Windows 8 Apr 15, 2025 pm 07:24 PM

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

Which operating systems are supported by Tigervnc in Debian Which operating systems are supported by Tigervnc in Debian Apr 12, 2025 pm 10:15 PM

The open source VNC tool Tigervnc is compatible with a wide range of operating systems, including Windows, Linux, and macOS. This article will introduce in detail the application of Tigervnc on the Debian system. Tigervnc is integrated in the application system of Debian system: In the Debian system, Tigervnc is integrated into the system as a VNC server component. Users can start VNC services through command line tools such as vncserver and customize display settings such as resolution and color depth. Cross-platform connection: Tigervnc client supports Windows, Linux, and macOS, which means users can run this from any

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Recommended system maintenance and optimization tools in Mac system Recommended system maintenance and optimization tools in Mac system Apr 12, 2025 pm 04:45 PM

Mac system maintenance includes: disk management (use OmniDiskSweeper to clean disk space, use disk tools to check disk errors) memory management (use Activity Monitor to monitor memory usage, end over-occupying processes) startup item management (use Linc or LaunchControl to manage startup items, disable unnecessary startup items) system cache cleaning (use CleanMyMac X or manually clean system cache) software update (timely update system and applications) regular backup (use Time Machine to backup data regularly) good usage habits (not installing applications excessively, cleaning files regularly, and monitoring system logs)

How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! Apr 17, 2025 pm 09:54 PM

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

git software installation git software installation Apr 17, 2025 am 11:57 AM

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

See all articles