Development and databases
Which MySQL variables can be changed on managed hosting
MySQL distinguishes global variables, which affect the whole server, from session variables, which apply to a single connection only. On a managed cloud hosting plan several accounts use the same MySQL service, so an account does not have root access or the administrative privileges needed to modify global variables (SYSTEM_VARIABLES_ADMIN in MySQL 8) and change the global configuration.
Scope of the variables
InnoDB buffers, the total connection limit and certain logs are managed at server level. max_allowed_packet has a global and a session value, but its session value is read-only for the MySQL server: it cannot be raised with a SET SESSION from the application. Other parameters, such as certain SQL modes, timeouts or character sets, can have different global and session values.
You can check both scopes with:
SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'; SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
Session variables
Some applications can run SET SESSION when they open each connection, if MySQL allows that variable to be changed. The change only lasts for that session and must be configured in the code, framework or database connector.
Do not use SET GLOBAL as a fix: it will fail for lack of privileges or would affect other accounts. Do not confuse PHP limits, such as memory_limit or upload_max_filesize, with MySQL variables either.
Alternatives
- Split large imports or queries into batches.
- Review SQL mode compatibility; do not disable validation just to hide incorrect data or queries. If the project needs an allowed session setting, test it first.
- Fix queries and schemas that use excessive memory or time.
- Use command-line tasks to avoid web server or PHP limits, bearing in mind that this does not change MySQL's own limits.
- For disconnections due to inactivity, set up connection recovery and check which operation completed before repeating it. A disconnection does not prove that a write failed.
- Check whether a current version of the application avoids the global requirement.
Before ruling out compatibility, send us the variable name, the required value and the software's documentation. We can check its scope and assess whether there is a per-session alternative or a safe server setting, but a global change cannot be guaranteed.
If the requirement turns out to be incompatible with a shared environment and needs permanent administrative privileges, you will need infrastructure under your own control, such as a VPS or a dedicated server. Hostsuar does not currently offer those environments; see the differences between a VPS and our cloud hosting.
A SET SESSION run in phpMyAdmin only changes that connection; it does not change your website's sessions or future connections in a pool. See the scope and privileges of each variable for the version you use and check the value from the application itself.
You may also find useful
- Create a database and its user with the cPanel wizard Create a MySQL database, its user and the permission assignment from the cPanel wizard to get an app...
- Manage MySQL databases, users and permissions in cPanel Manage MySQL databases, users, permissions, repairs and credential changes from cPanel, keeping each...
- Check your MySQL version and compatibility Identify the actual version of the MySQL server your application uses, review compatibility and tell...
- Clone a database Duplicate a MySQL database by first creating the destination and its permissions in cPanel, then cop...
Something wrong or out of date? Tell us and we will review it.