A.3. Installation-Related Issues

MySQL 5.0

A.3. Installation-Related Issues

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 , 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 at the end of your link command, where represents the pathname of the directory where the client library is located. To determine the correct directory, try this command:

shell> 

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

If you get errors for the or function, add to the end of your link command and try again.

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

You might get 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.9, “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 or indicate that the library can't be found, it means that your system can't find the shared 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 is located to the environment variable.

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

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

Another way to solve this problem is by linking your program statically with the 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. Problems with File Permissions

If you have problems with file permissions, the 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 value is . You can change this behavior by starting mysqld_safe as follows:

shell> 
shell> 
shell> 

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

shell> 
shell> 
shell> 

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

See Appendix F, Environment Variables.