	     Installation instructions for MySQL source release

QUICK INSTALL:

Unpack tar archive in mysql directory. (VERSION is a number like 3.20.0)
You may want to edit scripts/mysql_install_db to get right grant tables

  zcat mysql-VERSION.tar.gz | tar xvf -
  cd mysql-VERSION
  ./configure

To compile only the client add --without-server to ./configure. If you
don't want to have your data under /usr/local/var use something like.
./configure --prefix=/usr/local --localstatedir=/usr/local/data/mysql

For more configure information se INSTALL-SOURCE-GENERIC. For
configure options use ./configure --help.

Compile and install everything (GNU make is recomended):

  make
  make install

Create the grants database:

The default priviliges is that anybody may create/use the databases
named 'test' or starting with "test_". Root can do anyting. More
information in the FAQ.

To change the defaults edit the script before running it.
If this is the first time you install MySQL you must run this
command. If you don't do it you will get the error:
'Can't find file: './mysql/host.frm'
This also starts the mysqld demon the first time!

  scripts/mysql_install_db

Normal start of the MySQL server demon (not needed the first time):

  install-directory/bin/safe_mysqld --log

------------------------------------------------------------
Problems?

If your compile fails with something like:

configure: error: installation or configuration problem: C++ compiler cannot create executables.

- Try setting the environment variable CXX to gcc (If you are using gcc).
  For example 'CXX=gcc ./configure'. If you use this you don't nead to have
  libg++ installed!

- You can also install libg++. By default configure picks c++ as a compiler
  name and GNU c++ links with -lg++.

making all in mit-pthreads
make: Fatal error in reader: Makefile, line 18: Badly formed macro assignment

- This means you have to upgrade your make to GNU make.

If your make stops with "Can't find Makefile.PL" when making mysqlperl
you should try using gnu make. At least Solaris and FreeBSD is known to
have troublesome make programs.

If you get error messages from make or error message of type:
'pthread.h: No such file or directory'

- This means you have to upgrade your make to GNU make. (At least 3.75 works)

If configure fails, and you are going to mail mysql@tcx.se, please
include any lines from config.log that you think can help solve the problem.
Include also a couple of lines of the last output from configure if configure
aborts. Post the bug with the script 'mysqlbug'.

If you need to debug mysqld or a MySQL client, run configure with:

configure --with-debug=yes

If you get a error message like:
client/libmysql.c:273: parse error before `__attribute__'

- This means you need to upgrade your gcc compiler (2.7.2 is known to work).

------------------------------------------------------------

NOTES:

All MySQL programs compile clean (no warnings) for us. But warning may
appear because of different system include files. Se below for
warnings that may occur when using mit-pthreads.

When compiling sql_yacc.y you should probably get:

conflicts:  89 shift/reduce, 15 reduce/reduce

------------------------------------------------------------

LINUX notes:

LinuxThreads should be installed before configuring MySQL.
If you get an any error related to mysql_source/mit_threads/...
                                                ^^^^^^^^^^^ 
then configure didn't detect that you have LinuxThreads installed.

You should install libc 5.4.12 or newer before compiling MySQL.
glibc 2.0.2 should also work.

Some Linux distributions have an error in /usr/include/sched.h:
Change _P to __P in the above file if you get a compile error in sched.h

You will get some warnings when compiling: (these can be ignored)

mysqld.cc -o objs-thread/mysqld.o
mysqld.cc: In function `void init_signals()':
mysqld.cc:315: warning: assignment of negative value `-1' to `long unsigned int'
mysqld.cc: In function `void * signal_hand(void *)':
mysqld.cc:346: warning: assignment of negative value `-1' to `long unsigned int'

When using glibc 2 you must also execute the configure with
'CXX=gcc ./configure ....' because
if you compile with g++, you will link with libg++ which dosen't work with
LinuxThreads.

If you want in Debian GNU/Linux to get MySQL to auto start when system boots,
do the following:

> cp scripts/mysql.server /etc/init.d/mysql.server
> /usr/sbin/update-rc.d mysql.server defaults 99


------------------------------------------------------------
Linux-Sparc notes:

In some implementations readdir_r is broken.
This will be notised by that SHOW DATABASES always return an empty set.
This can be fixed by removing 'HAVE_READDIR_R' from config.h

------------------------------------------------------------
Linux-Alpha notes:

You must install glibc 2.0.2 with the linuxthreads addon before starting to
configure MySQL.

sys/select.h is broken.

To fix this:

> cd mysql-3.xxxx
> mkdir include/sys
> cp /usr/include/sys/select.h include/sys
> emacs include/sys/select.h

Change the line:

/* Representation of a set of file descriptors.  */
typedef __fd_set fd_set;

to

/* Representation of a set of file descriptors.  */
typedef __kernel_fd_set fd_set;

and change all references from __fd_set to fd_set.

------------------------------------------------------------

Perl notes:

When doing 'perl Makefile.PL' perl may say something like:

  Warning: -L../../client/ changed to -L/home/mysql-3.20.15-beta/perl/mysql

This can be ignored.

If you got a the following error (from mysqlperl or DBD-mysql):

/usr/bin/perl: can't resolve symbol '__moddi3'
/usr/bin/perl: can't resolve symbol '__divdi3'

you are probably using gcc. Add -L/usr/lib/gcc-lib/... -lgcc to the link
command where -L/...  is the path to the directory where libgcc.a is.

------------------------------------------------------------

SunOS notes:

You must have gnu make to compile MIT threads.

In readline you may get warnings about duplicated defines. These may be
ignored.

When compiling mysqld there will be some warnings about 'implicit declaration
of function'. These may be ignored.

------------------------------------------------------------

DEC-OSF1-Alpha notes:

In some versions the alloca() is broken.
Fix this by remove 'HAVE_ALLOCA' from config.h.

------------------------------------------------------------

SGI-IRIX notes:

You may have to undefine some things in config.h (generated after
running configure).

In some Irix implementations alloca is broken. If the mysqld server
dies on some selects remove HAVE_ALLOC & HAVE_ALLOCA_H from config.h.
If mysqladmin create doesn't work, remove 'HAVE_READDIR_R' from
config.h. Also you may have to remove HAVE_TERM_H.

Irix 6.2 doesn't support POSIX threads out of of the box.  You have
install these patches, available from SGI if you have support:

1403, 1404, 1644, 1717, 1918, 2000, 2044

------------------------------------------------------------

FreeBSD notes:

If you get link errors when compiling mysqlperl
(Type ient.a(my_getwd.o): RRS text relocation at 0x9a9f for "__db_pargs_")

You must recompile the mysqlperl library with -DPIC -fpic.

Do the following:

- First install everything
- Change in client/Makefile the line:
    CFLAGS = -g -O2
  to 
    CFLAGS = -O2 -DPIC -fpic 
- cd client
- rm *.o
- run make libmysqlclient.a
- cd ../perl/mysqlperl
- make

This shall be fixed in some future version of configure.

The FreeBSD make behaviour is slightly other than GNU make:s. If you have a
problem that mysqlperl/Makefile.PL doesn't get generated you should 
install gnu makes.

Other (temporary) solution:
> cd perl
> make mysqlperl/Makefile.PL
> make mysqlperl/mysql_test

If you get 'ERROR Can't create/write to file 'xxx.ISD' error 23' from MySQL
this means that you haven't allocated enough file descriptors for MySQL.
'perror #' will give you the error message in a more readable form.

Try using a ulimit -n 256 before starting safe_mysqld.  You can of course add
this to the safe_mysqld script. You can also make the table cache smaller with:
'safe_mysqld -O table_cache=32'  (default is 64).

------------------------------------------------------------

BSDI notes (from Jan Legenhausen <jleg@csl-gmbh.net>)

I finally got mysqlperl working on BSDI2.1.

What i did was almost nothing:
- cd client
- leave Makefile as it is! (i use GCC="shlicc2" per default ("setenv
CC   shlicc2" before launching "configure"); perl5 
  automagically uses shlicc2 - you should use _one_ version
  (either gcc or shlicc2) for both Mysql.c and libmysqlclient.a!)
- rm *.o
- gmake libmysqlclient.a
- cd ../perl/mysqlperl
- make clean
- add '$sysliblist=" -L$tmp -lgcc -lcompat";' to Makefile.PL line 45
  (just to be sure - i didn't check if one could leave out this one)
- perl Makefile.PL
- remove all old libmysqlclient.a's in /usr/lib; /usr/contrib/lib 
- make install
- ./mysql_test

...and enjoy the 'ok's'... :-)

------------------------------------------------------------

MIT thread notes:

Mit threads doesn't support the AF_UNIX protocol so we must use
the TCP/IP protocol for all connections (which is a little slower).
If you can't connect to a table, try using the host (-h or --host) switch.
This must be done if you have compiled the client code --without-server
because the default connection is to use Unix sockets.

MySQL compiled with MIT threads has as default system locking disabled
for performance reasons. One can start the server with system locking
with the --use-locking. Se the FAQ about system locking.

Sometimes (on Solaris) the pthread bind() command sometimes fails to bind to
a socket without any error message. The result of this is that all
connections to server fails:
> mysqladmin ver
mysqladmin: connect to server at '' failed; error: 'Can't connect to mysql server on localhost (146)'

The solution to this is to kill the mysqld demon and restart it.
This has only happened to me when I have forced the demon down and done an
restart at once.

sleep() isn't interruptible with SIGINT (break) in MIT-threads. This is only
notable in 'mysqladmin --sleep'. One have to wait for the end of the sleep
before the interrupt is served and the process stops.

I haven't got readline to work with MIT threads. (This isn't needed, but may
be interesting for someone)

When linking (at least on Solaris) you will receive this error message:

ld: warning: symbol `_iob' has differing sizes:
	(file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4; file /usr/lib/libc.so value=0x140);
	/my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
ld: warning: symbol `__iob' has differing sizes:
	(file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4; file /usr/lib/libc.so value=0x140);
	/my/local/pthreads/lib/libpthread.a(findfp.o) definition taken


Some other warnings which can be ignored:

implicit declaration of function `int strtoll(...)'
implicit declaration of function `int strtoul(...)'
