简体   繁体   English

在 mysql 上运行命令的位置

[英]where to run commands on mysql

I work on a java project using mysql as database, at some level I needed to increase the value of max_allowed_packet variable, I checked in the net but I can't find my.cnf or my.ini.我在一个使用 mysql 作为数据库的 java 项目上工作,在某种程度上我需要增加 max_allowed_pa​​cket 变量的值,我在网上检查但我找不到 my.cnf 或 my.ini。 So I need to run some recommended command such as set global max_allowed_packet=33554432 but I do not know where to find the terminal to do that.所以我需要运行一些推荐的命令,例如set global max_allowed_packet=33554432但我不知道在哪里可以找到终端来做到这一点。 I am using mySql 8.0 on windows 10我在 Windows 10 上使用 mySql 8.0

The default location for mysql.exe is C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin . mysql.exe的默认位置是C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin

In the same directory you will find mysqladmin.exe , which gives a clue about where my.cnf of my.ini is:在同一目录中,您将找到mysqladmin.exe ,它提供了有关my.ini my.cnf的线索:

mysqladmin | mysqladmin | findstr "my.ini" findstr "my.ini"

If the my.cnf or my.ini if not found at above locations, it is probably in the datadir如果在上述位置没有找到my.cnfmy.ini ,它可能在datadir

mysqladmin variables -u root -p | mysqladmin 变量 -u root -p | findstr datadir查找数据目录

You can configure using MySql Workbench.Navigate to menu items Server-->Status or System Variables.您可以使用 MySql Workbench 进行配置。导航到菜单项 Server-->Status 或 System Variables。 Search for max_allowed_packet搜索 max_allowed_pa​​cket

First you would need to log into your MySQL instance, typically you would do this from the command line... mysql -u root -p首先,您需要登录到您的 MySQL 实例,通常您会从命令行执行此操作... mysql -u root -p

That gets you to a MySQL prompt.这会让您进入 MySQL 提示符。 From there you can run a SET command从那里你可以运行一个SET命令

https://dev.mysql.com/doc/refman/8.0/en/set-variable.html https://dev.mysql.com/doc/refman/8.0/en/set-variable.html

SET variable = expr [, variable = expr] ...

variable: {
    user_var_name
  | param_name
  | local_var_name
  | {GLOBAL | @@GLOBAL.} system_var_name
  | [SESSION | @@SESSION. | @@] system_var_name
}

In your case that command would be SET global max_allowed_packet=33554432;在您的情况下,该命令将是SET global max_allowed_packet=33554432;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM