|
Installation Related Issues
If you are linking your program and you get errors for unreferenced symbols
that start with mysql_,
like the following:
/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 by adding
-Lpath-to-the-mysql-library
-lmysqlclient LAST on your link line.
If you get undefined
reference errors for the
uncompress or
compress function, add
-lz LAST on your
link line and try again!
If you get undefined
reference errors for functions that should exist on your system,
like connect, check the
man page for the function in question, for which libraries you should add to the
link line!
If you get undefined
reference errors for functions that don't exist on your system, like
the following:
mf_format.o(.text+0x201):
undefined reference to ´__lxstat'
it usually means that your library is compiled on a system that is not 100
% compatible with yours. In this case you should download the latest MySQL
source distribution and compile this yourself..
If you are trying to run a program and you then get errors for unreferenced
symbols that start with
mysql_ or that the
mysqlclient library
can't be found, this means that your system can't find the share
libmysqlclient.so
library.
The fix for this is to tell your system to search after shared libraries
where the library is located by one of the following methods:
- Add the path to the directory where you have
libmysqlclient.so the
LD_LIBRARY_PATH
environment variable.
- Add the path to the directory where you have
libmysqlclient.so the
LD_LIBRARY environment
variable.
- Copy
libmysqlclient.so to
some place that is searched by your system, like
´/lib', and update
the shared library information by executing
ldconfig.
Another way to solve this problem is to link your program
statically, with
-static, or by removing
the dynamic MySQL libraries before linking your code. In the second case you
should be sure that no other programs are using the dynamic libraries!
The MySQL server
mysqld can be started
and run by any user. In order to change
mysqld to run as a Unix
user user_name, you must
do the following:
- Stop the server if it's running (use
mysqladmin shutdown).
- Change the database directories and files so that
user_name has privileges
to read and write files in them (you may need to do this as the Unix
root user):
- shell> chown -R user_name
/path/to/mysql/datadir
If
directories or files within the MySQL data directory are symlinks, you'll also
need to follow those links and change the directories and files they point to.
chown -R may not follow
symlinks for you.
- Start the server as user
user_name, or, if you
are using MySQL Version 3.22 or later, start
mysqld as the Unix
root user and use the
--user=user_name option.
mysqld will switch to
run as the Unix user
user_name before
accepting any connections.
- To start the server as the given user name automatically at system startup
time, add a user line
that specifies the user name 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
At
this point, your mysqld
process should be running fine and dandy as the Unix user
user_name. One thing
hasn't changed, though: the contents of the permissions tables. By default
(right after running the permissions table install script
mysql_install_db), the
MySQL user root is the
only user with permission to access the
mysql database or to
create or drop databases. Unless you have changed those permissions, they still
hold. This shouldn't stop you from accessing MySQL as the MySQL
root user when you're
logged in as a Unix user other than
root; just specify the
-u root option to the
client program.
Note that accessing MySQL as
root, by supplying
-u root on the command
line, has nothing to do with MySQL running as the Unix
root user, or, indeed,
as another Unix user. The access permissions and user names of MySQL are
completely separate from Unix user names. The only connection with Unix user
names is that if you don't provide a
-u option when you
invoke a client program, the client will try to connect using your Unix login
name as your MySQL user name.
If your Unix box itself isn't secured, you should probably at least put a
password on the MySQL
root users in the access
tables. Otherwise, any user with an account on that machine can run
mysql -u root db_name
and do whatever he likes.
If you have problems with file permissions, for example, if
mysql issues the
following error message when you create a table:
ERROR: Can't find file:
'path/with/filename.frm' (Errcode: 13)
then the environment variable
UMASK might be set
incorrectly when mysqld
starts up. The default umask value is
0660. You can change
this behavior by starting
safe_mysqld as follows:
shell> UMASK=384 # = 600 in
octal
shell> export
UMASK
shell> /path/to/safe_mysqld
&
By default MySQL will create database and
RAID directories with
permission type 0700. You can modify this behavior by setting the
UMASK_DIR variable. If
you set this, new directories are created with the combined
UMASK and
UMASK_DIR. For example,
if you want to give group access to all new directories, you can do:
shell> UMASK_DIR=504 # =
770 in octal
shell> export
UMASK_DIR
shell> /path/to/safe_mysqld
&
In MySQL Version 3.23.25 and above, MySQL assumes that the value for
UMASK and
UMASK_DIR is in octal if
it starts with a zero
|