


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!

The steps for upgrading MySQL database include: 1. Backup the database, 2. Stop the current MySQL service, 3. Install the new version of MySQL, 4. Start the new version of MySQL service, 5. Recover the database. Compatibility issues are required during the upgrade process, and advanced tools such as PerconaToolkit can be used for testing and optimization.

MySQL backup policies include logical backup, physical backup, incremental backup, replication-based backup, and cloud backup. 1. Logical backup uses mysqldump to export database structure and data, which is suitable for small databases and version migrations. 2. Physical backups are fast and comprehensive by copying data files, but require database consistency. 3. Incremental backup uses binary logging to record changes, which is suitable for large databases. 4. Replication-based backup reduces the impact on the production system by backing up from the server. 5. Cloud backups such as AmazonRDS provide automation solutions, but costs and control need to be considered. When selecting a policy, database size, downtime tolerance, recovery time, and recovery point goals should be considered.

MySQLclusteringenhancesdatabaserobustnessandscalabilitybydistributingdataacrossmultiplenodes.ItusestheNDBenginefordatareplicationandfaulttolerance,ensuringhighavailability.Setupinvolvesconfiguringmanagement,data,andSQLnodes,withcarefulmonitoringandpe

Optimizing database schema design in MySQL can improve performance through the following steps: 1. Index optimization: Create indexes on common query columns, balancing the overhead of query and inserting updates. 2. Table structure optimization: Reduce data redundancy through normalization or anti-normalization and improve access efficiency. 3. Data type selection: Use appropriate data types, such as INT instead of VARCHAR, to reduce storage space. 4. Partitioning and sub-table: For large data volumes, use partitioning and sub-table to disperse data to improve query and maintenance efficiency.

TooptimizeMySQLperformance,followthesesteps:1)Implementproperindexingtospeedupqueries,2)UseEXPLAINtoanalyzeandoptimizequeryperformance,3)Adjustserverconfigurationsettingslikeinnodb_buffer_pool_sizeandmax_connections,4)Usepartitioningforlargetablestoi

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.


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

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
