MySQL
  Home arrow MySQL arrow Page 5 - Troubleshooting Problems with MySQL Programs
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
MYSQL

Troubleshooting Problems with MySQL Programs
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 27
    2004-09-29


    Table of Contents:
  • Troubleshooting Problems with MySQL Programs
  • Common Errors When Using MySQL Programs
  • Authentication Protocol
  • Memory and Lost Connection
  • Packet too Large
  • Table Full
  • File Not Found
  • Installation-Related Issues
  • Administration-Related Issues
  • How to Deal with MySQL if it Crashes
  • How MySQL Handles a Full Disk, Temp Files, Socket Files and Time Zones

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Troubleshooting Problems with MySQL Programs - Packet too Large
    ( Page 5 of 11 )

    A.2.9 Packet too large

    A communication packet is a single SQL statement sent to the MySQL server or a single row that is sent to the client.

    In MySQL 3.23, the largest possible packet is 16MB, due to limits in the client/server protocol. In MySQL 4.0.1 and up, the limit is 1GB.

    When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection. With some clients, you may also get a Lost connection to MySQL server during query error if the communication packet is too large.

    Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server.

    If you are using the mysql client program, its default max_allowed_packet variable is 16MB. That is also the maximum value before MySQL 4.0. To set a larger value from 4.0 on, start mysql like this:

    mysql> mysql --max_allowed_packet=32M

    That sets the packet size to 32MB.

    The server's default max_allowed_packet value is 1MB. You can increase this if the server needs to handle big queries (for example, if you are working with big BLOB columns). For example, to set the variable to 16MB, start the server like this:

    mysql> mysqld --max_allowed_packet=16M

    Before MySQL 4.0, use this syntax instead:

    mysql> mysqld --set-variable=max_allowed_packet=16M

    You can also use an option file to set max_allowed_packet. For example, to set the size for the server to 16MB, add the following lines in an option file:

    [mysqld]
    max_allowed_packet=16M

    Before MySQL 4.0, use this syntax instead:

    [mysqld]
    set-variable = max_allowed_packet=16M

    It's safe to increase the value of this variable because the extra memory is allocated only when needed. For example, mysqld allocates more memory only when you issue a long query or when mysqld must return a large result row. The small default value of the variable is a precaution to catch incorrect packets between the client and server and also to ensure that you don't run out of memory by using large packets accidentally.

    You can also get strange problems with large packets if you are using large BLOB values but have not given mysqld access to enough memory to handle the query. If you suspect this is the case, try adding ulimit -d 256000 to the beginning of the mysqld_safe script and restarting mysqld.

    A.2.10 Communication Errors and Aborted Connections

    The server error log can be a useful source of information about connection problems. See Section 4.8.1, "The Error Log." Starting with MySQL 3.23.40, if you start the server with the --warnings option (or --log-warnings from MySQL 4.0.3 on), you might find messages like this in your error log:

    010301 14:38:23 Aborted connection 854 to db: 'users' user: 'josh'

    If Aborted connections messages appear in the error log, the cause can be any of the following:

    • The client program did not call mysql_close() before exiting.

    • The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to the server. See Section 4.2.3, "Server System Variables."

    • The client program ended abruptly in the middle of a data transfer.

    When any of these things happen, the server increments the Aborted_clients status variable.

    The server increments the Aborted_connects status variable when the following things happen:

    • A client doesn't have privileges to connect to a database.

    • A client uses an incorrect password.

    • A connection packet doesn't contain the right information.

    • It takes more than connect_timeout seconds to get a connect packet. See Section 4.2.3, "Server System Variables."

    If these kinds of things happen, it might indicate that someone is trying to break into your server!

    Other reasons for problems with aborted clients or aborted connections:

    • Use of Ethernet protocol with Linux, both half and full duplex. Many Linux Ethernet drivers have this bug. You should test for this bug by transferring a huge file via FTP between the client and server machines. If a transfer goes in burst-pause-burst-pause mode, you are experiencing a Linux duplex syndrome. The only solution is switching the duplex mode for both your network card and hub/switch to either full duplex or to half duplex and testing the results to determine the best setting.

    • Some problem with the thread library that causes interrupts on reads.

    • Badly configured TCP/IP.

    • Faulty Ethernets, hubs, switches, cables, and so forth. This can be diagnosed properly only by replacing hardware.

    • The max_allowed_packet variable value is too small or queries require more memory than you have allocated for mysqld. See Section A.2.9, "Packet too large."

       

    SamsThis chapter is from MySQL Administrator's Guide, by MySQL AB. (Sams, 2004, ISBN: 0672326345). Check it out at your favorite bookstore today. Buy this book now.



     
     
    >>> More MySQL Articles          >>> More By Sams Publishing
     

       

    MYSQL ARTICLES

    - MySQL Security Tips
    - Designing a MySQL Database: Tips and Techniq...
    - The Three Most Important MySQL Queries
    - Null and Empty Strings
    - MySQL Server Tuning Tips and Tricks
    - MySQL Query Optimizations and Schema Design
    - MySQL Benchmarking Tools and Utilities
    - MySQL Benchmarking Concepts and Strategies
    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek