


Tutorial on how to install the decompressed version of MySQL5.7.18 under Windows
这篇文章主要为大家详细介绍了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
2 配置环境变量,在Path中配置bin目录
3 初始化数据库,生成data文件夹以及其中的一些配置文件(初始化后会生成root账户的默认密码:在xx.err文件中)
mysqld -initialize # err文件示例: [Note] A temporary password is generated for root@localhost: w1BI/g/y.wfx
4 注册服务
mysqld -install
5 启动MySQL
net start mysql
6 启动后登录,填入生成的默认密码
mysql -uroot -p
7 修改账户的密码
set password for root@localhost=password('root');
8 停止MySQL服务
net stop mysql
9 若想删除MySQL服务,可以是有下面命令删除
mysqld -remove
二、安装后问题
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
原因: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';
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'
三 控制脚本
最后写一个控制脚本,这样就可以在自己使用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
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

The MySQL connection may be due to the following reasons: MySQL service is not started, the firewall intercepts the connection, the port number is incorrect, the user name or password is incorrect, the listening address in my.cnf is improperly configured, etc. The troubleshooting steps include: 1. Check whether the MySQL service is running; 2. Adjust the firewall settings to allow MySQL to listen to port 3306; 3. Confirm that the port number is consistent with the actual port number; 4. Check whether the user name and password are correct; 5. Make sure the bind-address settings in my.cnf are correct.

The main reasons for MySQL installation failure are: 1. Permission issues, you need to run as an administrator or use the sudo command; 2. Dependencies are missing, and you need to install relevant development packages; 3. Port conflicts, you need to close the program that occupies port 3306 or modify the configuration file; 4. The installation package is corrupt, you need to download and verify the integrity; 5. The environment variable is incorrectly configured, and the environment variables must be correctly configured according to the operating system. Solve these problems and carefully check each step to successfully install MySQL.

Unable to access MySQL from the terminal may be due to: MySQL service not running; connection command error; insufficient permissions; firewall blocks connection; MySQL configuration file error.

The solution to MySQL installation error is: 1. Carefully check the system environment to ensure that the MySQL dependency library requirements are met. Different operating systems and version requirements are different; 2. Carefully read the error message and take corresponding measures according to prompts (such as missing library files or insufficient permissions), such as installing dependencies or using sudo commands; 3. If necessary, try to install the source code and carefully check the compilation log, but this requires a certain amount of Linux knowledge and experience. The key to ultimately solving the problem is to carefully check the system environment and error information, and refer to the official documents.

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).

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.

MySQL refused to start? Don’t panic, let’s check it out! Many friends found that the service could not be started after installing MySQL, and they were so anxious! Don’t worry, this article will take you to deal with it calmly and find out the mastermind behind it! After reading it, you can not only solve this problem, but also improve your understanding of MySQL services and your ideas for troubleshooting problems, and become a more powerful database administrator! The MySQL service failed to start, and there are many reasons, ranging from simple configuration errors to complex system problems. Let’s start with the most common aspects. Basic knowledge: A brief description of the service startup process MySQL service startup. Simply put, the operating system loads MySQL-related files and then starts the MySQL daemon. This involves configuration
