- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Using Options to Set MySQL Program Variables
Many of the MySQL programs have internal variables that are set during runtime using the SET statement. Most of these program variables can also be set at server startup with the help of the same syntax that applies to specifying the program options.
The mysql has a max_allowed_packet variable which controls the maximum size of its communication buffer.
To set this max_allowed_packet variable for mysql to a value of 16MB, either of the below mentioned commands can be used −
mysql --max_allowed_packet=16777216 (or) mysql --max_allowed_packet=16M
The first command specifies the value in terms of bytes. On the other hand, the second command specifies the value in megabytes (MB, i.e M).
For variables that have a numeric value, the value could be given with the help of a suffix of K, M, or G that would indicate a multiplier of 1024, 10242 or 10243.
In an option file, variable settings will be provided without the leading dashes −
[mysql] max_allowed_packet=16777216 (or) [mysql] max_allowed_packet=16M
If required, underscores can be specified in an option name as dashes. The below mentioned option groups are both equivalent.
Both of them will set the size of the server's key buffer to 512MB.
[mysqld] key_buffer_size=512M (or) [mysqld] key-buffer-size=512M
- What are the options and variables introduced in MySQL 8.0?
- What are the options and variables deprecated in MySQL 8.0?
- How to Set environment variables using PowerShell?
- Set options while creating a MySQL table. Display the same options as well
- Connecting to the MySQL Server Using Command Options
- How to set Image objects properties from options using FabricJS?
- What are the options and variables that were removed in MySQL 8.0?
- How to list all variables initialized by SET operator in MySQL?
- Using variables with MySQL prepare statement
- Using User-Defined Variables in MySQL
- MySQL Client Options
- Using Options on the Command Line for MySQL programs?
- Display different variables in MySQL using LIKE?
- How to specify options for MySQL programs?
- Adding options to a using jQuery?