Many MySQL programs have internal variables that are set at run time using the SET statement. Most program variables can also be set at server startup, using the same syntax as specifying program options.
Example 1
mysql has a max_allowed_packet variable that controls the maximum size of its communication buffer.
To set the max_allowed_packet variable of mysql to 16MB, you can use the commands mentioned below -
mysql --max_allowed_packet=16777216 (or) mysql --max_allowed_packet=16M
The first command specifies the value in bytes. The second command, on the other hand, specifies the value in megabytes (MB, or M).
For variables with numeric values, the value can be given with the help of the suffix K, M or G to represent a multiplier of 1024, 10242 or 10243.
Example 2
In the options file, variable settings will be provided without the leading dash -
[mysql] max_allowed_packet=16777216 (or) [mysql] max_allowed_packet=16M
If desired, underscores can be specified as dashes in option names . The option groups mentioned below are all equivalent.
They both set the server key buffer size to 512MB.
[mysqld] key_buffer_size=512M (or) [mysqld] key-buffer-size=512M
The above is the detailed content of Setting MySQL program variables using options. For more information, please follow other related articles on the PHP Chinese website!

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft