클라이언트의 mysql max_allowed_packet을 늘리는 방법은 무엇입니까?

클라이언트의 mysql max_allowed_packet을 늘리는 방법은 무엇입니까?

max_allowed_packet원격 서버를 사용하는 MySQL 클라이언트의 변수 크기를 늘리고 싶습니다 . 나는 그것을 검색했고 내가 찾을 수 있는 답변은 서버 변수 변경에 대해서만 논의했습니다.

내 클라이언트 프로그램은 Windows 7용 MySQL Workbench입니다.

답변1

에 따르면max_allowed_packet에 대한 MySQL 설명서

mysql 및 mysqldump와 같은 일부 프로그램을 사용하면 명령줄이나 옵션 파일에서 max_allowed_packet을 설정하여 클라이언트측 값을 변경할 수 있습니다.

명령줄에서 512M으로 설정하려면 다음과 같이 mysql 클라이언트를 실행하면 됩니다.

C:\>mysql -u... -p...

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.5.12-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.00 sec)

mysql> set max_allowed_packet=1024 * 1024 * 512;
ERROR 1621 (HY000): SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
mysql> set global max_allowed_packet=1024 * 1024 * 512;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.00 sec)

mysql> exit
Bye

C:\>mysql -u... -p...
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 5.5.12-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like 'max_allowed_packet';
+--------------------+-----------+
| Variable_name      | Value     |
+--------------------+-----------+
| max_allowed_packet | 536870912 |
+--------------------+-----------+
1 row in set (0.00 sec)

전역적으로 설정해야 합니다. 로컬로 설정할 수는 없습니다.

당신은슈퍼 특전전역 변수를 설정합니다.

관련 정보