简体   繁体   中英

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. 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. I am using mySql 8.0 on windows 10

The default location for mysql.exe is 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 | findstr "my.ini"

If the my.cnf or my.ini if not found at above locations, it is probably in the datadir

mysqladmin variables -u root -p | findstr datadir

You can configure using MySql Workbench.Navigate to menu items Server-->Status or System Variables. Search for max_allowed_packet

First you would need to log into your MySQL instance, typically you would do this from the command line... mysql -u root -p

That gets you to a MySQL prompt. From there you can run a SET command

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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