MySQL Server - Set max_allowed_packet value permanently - mysql

I have a MySQL Server version 5.5.25 installed on CentOS server.
I've increased *max_allowed_packet* size to 32M in /etc/my.cnf file in order to store it permanently (max_allowed_packet = 32M;), then I've restarted server with /etc/init.d/mysqld restart. The problem is that in PHPMyAdmin the value doesn't change. I tried to set variable from shell with SET GLOBAL max_allowed_packet = 33554432; (32 MB), but shell returns "0 rows affected".
Is it a bug of MySQL server? Or maybe I'm wrong?

Did you restart Apache?
service httpd restart

Related

Innodb_buffer_pool_size not set

I am trying to update MySQL "innodb_buffer_pool_size" in windows server. I have run "set global innodb_buffer_pool_size=25610241024".
After I restart the server it's set back to 8M again.
If I change my.ini file then MySQL57 service is not running.
I am using MySQL 5.7.36.
To save setting, you need to put them in a my.ini file that the mysql server reads on startup.
SET GLOBAL... only affect the current running instance.

mysql server stops while initializing hybris on mac os

Just to share my experience of setting up Hybris for the first time on macOS.
Problem:
My hybris server and MySQL server got started without any issue, but as soon as I did an initialization on Hybris from HAC, mySQL server gets stopped after some time and initialization stuck in between. Tried this process multiple times.
I have tried different configurations of mySQL using my.cnf file but got no success.
Hybris version: 6.6.0.3
MySQL version: 5.7.28
Got the final solution that worked for me, below is the set of configurations that i added in /etc/my.cnf file:
[mysqld]
wait_timeout = 6000
interactive_timeout = 6000
bind-address = 127.0.0.1
innodb_flush_log_at_trx_commit=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
max_connections=500
max_allowed_packet=1024M
innodb_file_per_table=0
thread_stack=500K
I hope this will help any newcomer setting up Hybris with MYSQL.
Cheers

mysql config file change on ubuntu not reflected

I am running an Xubuntu 16.04 machine, and have installed mysql version 5.6. I wanted to change the mysql settings buffer pool size among other things. I tried editing /etc/mysql/my.cnf, /etc/mysql/conf.d/mysql.cnf. Then restarted mysql server. After that, when I login to mysql console and try to print the variables, I still do not see the values I entered in the config files. What am I missing?
EDIT
I have put the settings under [mysqld] section. Below is the content of the above files:
[mysqld]
innodb_buffer_pool_size=4G
innodb_log_buffer_size=512M
innodb_log_file_size=2G
innodb_write_io_threads=16
innodb_flush_log_at_trx_commit=0

How to increase the Mysql Connection limit in etc/my.cnf

I want to increase the max connection limit in mysql.
My current file /etc/my.cnf looks like this
[mysqld]
innodb_file_per_table=1
When I try to increase the connection limit by adding this variable then I cannot restart mysql service.
[mysqld]
innodb_file_per_table=1
set-variable=max_connections=10000
You can change the limit from your mysql config file which is located in where you have installed the mysql server database, .ini file
search for the max_connection variable and change the value as per your request
and you have restart your server after changing

MySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytes

I'm importing a MySQL dump and getting the following error.
$ mysql foo < foo.sql
ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes
Apparently there are attachments in the database, which makes for very large inserts.
This is on my local machine, a Mac with MySQL 5 installed from the MySQL package.
Where do I change max_allowed_packet to be able to import the dump?
Is there anything else I should set?
Just running mysql --max_allowed_packet=32M … resulted in the same error.
You probably have to change it for both the client (you are running to do the import) AND the daemon mysqld that is running and accepting the import.
For the client, you can specify it on the command line:
mysql --max_allowed_packet=100M -u root -p database < dump.sql
Also, change the my.cnf or my.ini file (usually found in /etc/mysql/) under the mysqld section and set:
max_allowed_packet=100M
or you could run these commands in a MySQL console connected to that same server:
set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
(Use a very large value for the packet size.)
As michaelpryor said, you have to change it for both the client and the daemon mysqld server.
His solution for the client command-line is good, but the ini files don't always do the trick, depending on configuration.
So, open a terminal, type mysql to get a mysql prompt, and issue these commands:
set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
Keep the mysql prompt open, and run your command-line SQL execution on a second terminal..
This can be changed in your my.ini file (on Windows, located in \Program Files\MySQL\MySQL Server) under the server section, for example:
[mysqld]
max_allowed_packet = 10M
Re my.cnf on Mac OS X when using MySQL from the mysql.com dmg package distribution
By default, my.cnf is nowhere to be found.
You need to copy one of /usr/local/mysql/support-files/my*.cnf to /etc/my.cnf and restart mysqld. (Which you can do in the MySQL preference pane if you installed it.)
The fix is to increase the MySQL daemon’s max_allowed_packet. You can do this to a running daemon by logging in as Super and running the following commands.
# mysql -u admin -p
mysql> set global net_buffer_length=1000000;
Query OK, 0 rows affected (0.00 sec)
mysql> set global max_allowed_packet=1000000000;
Query OK, 0 rows affected (0.00 sec)
Then to import your dump:
gunzip < dump.sql.gz | mysql -u admin -p database
In etc/my.cnf try changing the max_allowed _packet and net_buffer_length to
max_allowed_packet=100000000
net_buffer_length=1000000
if this is not working then try changing to
max_allowed_packet=100M
net_buffer_length=100K
On CENTOS 6 /etc/my.cnf , under [mysqld] section the correct syntax is:
[mysqld]
# added to avoid err "Got a packet bigger than 'max_allowed_packet' bytes"
#
net_buffer_length=1000000
max_allowed_packet=1000000000
#
I have resolved my issue by this query
SET GLOBAL max_allowed_packet=1073741824;
and check max_allowed_packet with this query
SHOW VARIABLES LIKE 'max_allowed_packet';
Use a max_allowed_packet variable issuing a command like
mysql --max_allowed_packet=32M
-u root -p database < dump.sql
Slightly unrelated to your problem, so here's one for Google.
If you didn't mysqldump the SQL, it might be that your SQL is broken.
I just got this error by accidentally having an unclosed string literal in my code. Sloppy fingers happen.
That's a fantastic error message to get for a runaway string, thanks for that MySQL!
Error:
ERROR 1153 (08S01) at line 6772: Got a packet bigger than
'max_allowed_packet' bytes Operation failed with exitcode 1
QUERY:
SET GLOBAL max_allowed_packet=1073741824;
SHOW VARIABLES LIKE 'max_allowed_packet';
Max value:
Default Value (MySQL >= 8.0.3) 67108864
Default Value (MySQL <= 8.0.2) 4194304
Minimum Value 1024
Maximum Value 1073741824
Sometimes type setting:
max_allowed_packet = 16M
in my.ini is not working.
Try to determine the my.ini as follows:
set-variable = max_allowed_packet = 32M
or
set-variable = max_allowed_packet = 1000000000
Then restart the server:
/etc/init.d/mysql restart
It is a security risk to have max_allowed_packet at higher value, as an attacker can push bigger sized packets and crash the system.
So, Optimum Value of max_allowed_packet to be tuned and tested.
It is to better to change when required (using set global max_allowed_packet = xxx)
than to have it as part of my.ini or my.conf.
I am working in a shared hosting environment and I have hosted a website based on Drupal. I cannot edit the my.ini file or my.conf file too.
So, I deleted all the tables which were related to Cache and hence I could resolve this issue. Still I am looking for a perfect solution / way to handle this problem.
Edit - Deleting the tables created problems for me, coz Drupal was expecting that these tables should be existing. So I emptied the contents of these tables which solved the problem.
Set max_allowed_packet to the same (or more) than what it was when you dumped it with mysqldump. If you can't do that, make the dump again with a smaller value.
That is, assuming you dumped it with mysqldump. If you used some other tool, you're on your own.