MySQL
  Home arrow MySQL arrow Page 8 - Troubleshooting Problems with MySQL Pr...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM developerWorks
 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? 
MYSQL

Troubleshooting Problems with MySQL Programs
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 25
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Troubleshooting Problems with MySQL Programs - Installation-Related Issues


    (Page 8 of 11 )

    A.3.1 Problems Linking to the MySQL Client Library

    When you are linking an application program to use the MySQL client library, you might get undefined reference errors for symbols that start with mysql_, such as those shown here:

    /tmp/ccFKsdPa.o: In function ´main':
    /tmp/ccFKsdPa.o(.text+0xb): undefined reference to ´mysql_init'
    /tmp/ccFKsdPa.o(.text+0x31): undefined reference to ´mysql_real_connect'
    /tmp/ccFKsdPa.o(.text+0x57): undefined reference to ´mysql_real_connect'
    /tmp/ccFKsdPa.o(.text+0x69): undefined reference to ´mysql_error'
    /tmp/ccFKsdPa.o(.text+0x9a): undefined reference to ´mysql_close'

    You should be able to solve this problem by adding -Ldir_path -lmysqlclient at the end of your link command, where dir_path represents the pathname of the directory where the client library is located. To determine the correct directory, try this command:

    shell> mysql_config --libs

    The output from mysql_config might indicate other libraries that should be specified on the link command as well.

    If you get undefined reference errors for the uncompress or compress function, add -lz to the end of your link command and try again.

    If you get undefined reference errors for a function that should exist on your system, such as connect, check the manual page for the function in question to determine which libraries you should add to the link command.

    You might get undefined reference errors such as the following for functions that don't exist on your system:

    mf_format.o(.text+0x201): undefined reference to ´__lxstat'

    This usually means that your MySQL client library was compiled on a system that is not 100% compatible with yours. In this case, you should download the latest MySQL source distribution and compile MySQL yourself. See Section 2.3, "MySQL Installation Using a Source Distribution."

    You might get undefined reference errors at runtime when you try to execute a MySQL program. If these errors specify symbols that start with mysql_ or indicate that the mysqlclient library can't be found, it means that your system can't find the shared libmysqlclient.so library. The fix for this is to tell your system to search for shared libraries where the library is located. Use whichever of the following methods is appropriate for your system:

    • Add the path to the directory where libmysqlclient.so is located to the LD_LIBRARY_PATH environment variable.

    • Add the path to the directory where libmysqlclient.so is located to the LD_LIBRARY environment variable.

    • Copy libmysqlclient.so to some directory that is searched by your system, such as /lib, and update the shared library information by executing ldconfig.

    Another way to solve this problem is by linking your program statically with the -static option, or by removing the dynamic MySQL libraries before linking your code. Before trying the second method, you should be sure that no other programs are using the dynamic libraries.

    A.3.2 How to Run MySQL as a Normal User

    On Windows, you can run the server as a Windows service using normal user accounts beginning with MySQL 4.0.17 and 4.1.2. (Older MySQL versions required you to have administrator rights. This was a bug introduced in MySQL 3.23.54.)

    On Unix, the MySQL server mysqld can be started and run by any user. However, you should avoid running the server as the Unix root user for security reasons. In order to change mysqld to run as a normal unprivileged Unix user user_name, you must do the following:

    1. Stop the server if it's running (use mysqladmin shutdown).

    2. Change the database directories and files so that user_name has privileges to read and write files in them (you might need to do this as the Unix root user):
      shell> chown -R user_name /path/to/mysql/datadir
    3. If you do not do this, the server will not be able to access databases or tables when it runs as user_name.

    4. If directories or files within the MySQL data directory are symbolic links, you'll also need to follow those links and change the directories and files they point to. chown -R might not follow symbolic links for you.

    5. Start the server as user user_name. If you are using MySQL 3.22 or later, another alternative is to start mysqld as the Unix root user and use the --user=user_name option. mysqld will start up, then switch to run as the Unix user user_name before accepting any connections.

    6. To start the server as the given user automatically at system startup time, specify the username by adding a user option to the [mysqld] group of the /etc/my.cnf option file or the my.cnf option file in the server's data directory. For example:
      [mysqld]
      user=user_name

    If your Unix machine itself isn't secured, you should assign passwords to the MySQL root accounts in the grant tables. Otherwise, any user with a login account on that machine can run the mysql client with a --user=root option and perform any operation. (It is a good idea to assign passwords to MySQL accounts in any case, but especially so when other login accounts exist on the server host.) See Section 2.4, "Post-Installation Setup and Testing."  

    A.3.3 Problems with File Permissions

    If you have problems with file permissions, the UMASK environment variable might be set incorrectly when mysqld starts. For example, MySQL might issue the following error message when you create a table:

    ERROR: Can't find file: 'path/with/filename.frm' (Errcode: 13)

    The default UMASK value is 0660. You can change this behavior by starting mysqld_safe as follows:

    shell> UMASK=384 # = 600 in octal
    shell> export UMASK
    shell> mysqld_safe &

    By default, MySQL creates database and RAID directories with an access permission value of 0700. You can modify this behavior by setting the UMASK_DIR variable. If you set its value, new directories are created with the combined UMASK and UMASK_DIR values. For example, if you want to give group access to all new directories, you can do this:

    shell> UMASK_DIR=504 # = 770 in octal
    shell> export UMASK_DIR
    shell> mysqld_safe &

    In MySQL 3.23.25 and above, MySQL assumes that the value for UMASK and UMASK_DIR is in octal if it starts with a zero.

    See Appendix B, "Environment Variables."   

    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


       · hi this is what is happening when i try to get into my email. I really need please...
     

       

    MYSQL ARTICLES

    - 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...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...
    - Creating the Blog Script for a PHP/MySQL Blo...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway