forked from bobtfish/DBD-mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.html
executable file
·795 lines (740 loc) · 29.1 KB
/
INSTALL.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>INSTALL - How to install and configure DBD::mysql</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#prerequisites">PREREQUISITES</a></li>
<li><a href="#binary_installation">BINARY INSTALLATION</a></li>
<ul>
<li><a href="#windows">Windows</a></li>
<li><a href="#red_hat_linux">Red Hat Linux</a></li>
<li><a href="#fedora_core_linux">Fedora Core Linux</a></li>
<li><a href="#other_systems">Other systems</a></li>
</ul>
<li><a href="#source_installation">SOURCE INSTALLATION</a></li>
<ul>
<li><a href="#cpan_installation">CPAN installation</a></li>
<li><a href="#manual_installation">Manual installation</a></li>
<li><a href="#configuration">Configuration</a></li>
<li><a href="#linker_flags">Linker flags</a></li>
</ul>
<li><a href="#special_systems">SPECIAL SYSTEMS</a></li>
<ul>
<li><a href="#windows_cygwin">Windows/CygWin</a></li>
</ul>
<li><a href="#known_problems">KNOWN PROBLEMS</a></li>
<li><a href="#support">SUPPORT</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>INSTALL - How to install and configure DBD::mysql</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
perl Makefile.PL [options]
make
make test
make install</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This document describes the installation and configuration of
DBD::mysql, the Perl DBI driver for the MySQL database. Before
reading on, make sure that you have the prerequisites available:
Perl, MySQL and DBI. For details see the separate section.
<a href="#prerequisites">PREREQUISITES</a>.</p>
<p>Depending on your version of Perl, it might be possible to
use a binary distribution of DBD::mysql. If possible, this is
recommended. Otherwise you need to install from the sources.
If so, you will definitely need a C compiler. Installation
from binaries and sources are both described in separate
sections. <a href="#binary_installation">BINARY INSTALLATION</a>. <a href="#source_installation">SOURCE INSTALLATION</a>.</p>
<p>Finally, if you encounter any problems, do not forget to
read the section on known problems. <a href="#known_problems">KNOWN PROBLEMS</a>. If
that doesn't help, you should look into the archive of the
mailing list <strong><a href="mailto:[email protected]">[email protected]</a></strong>. See
<a href="http://www.mysql.com">http://www.mysql.com</a> for archive locations. And if that
still doesn't help, please post a question on this mailing
list.</p>
<p>
</p>
<hr />
<h1><a name="prerequisites">PREREQUISITES</a></h1>
<dl>
<dt><strong><a name="perl" class="item">Perl</a></strong></dt>
<dd>
<p>Preferrably a version of Perl, that comes preconfigured with
your system. For example, all Linux and FreeBSD distributions
come with Perl. For Windows, ActivePerl is recommended, see
<a href="http://www.activestate.com">http://www.activestate.com</a> for details.</p>
</dd>
<dt><strong><a name="mysql" class="item">MySQL</a></strong></dt>
<dd>
<p>You need not install the actual MySQL database server, the
client files and the devlopment files are sufficient. For
example, Fedora Core 4 Linux distribution comes with RPM files
(using YUM) <strong>mysql.i386</strong> and <strong>mysql-server.i386</strong> (use "yum search"
to find exact package names). These are sufficient, if the MySQL
server is located on a foreign machine. You may also create client
files by compiling from the MySQL source distribution and using</p>
<pre>
configure --without-server</pre>
<p>If you are using Windows and need to compile from sources
(which is only the case if you are not using ActivePerl),
then you must ensure that the header and library files are
installed. This may require choosing a "Custom installation"
and selecting the appropriate option when running the
MySQL setup program.</p>
</dd>
<dt><strong><a name="dbi" class="item">DBI</a></strong></dt>
<dd>
<p>DBD::mysql is a DBI driver, hence you need DBI. It is available
from the same source where you got the DBD::mysql distribution
from.</p>
</dd>
<dt><strong><a name="c_compiler" class="item">C compiler</a></strong></dt>
<dd>
<p>A C compiler is only required, if you install from source. In
most cases there are binary distributions of DBD::mysql
available. However, if you need a C compiler, make sure, that
it is the same C compiler that was used for compiling Perl and
MySQL! Otherwise you will almost definitely encounter problems
because of differences in the underlying C runtime libraries.</p>
<p>In the worst case, this might mean to compile Perl and MySQL
yourself. But believe me, experience shows that a lot of problems
are fixed this way.</p>
</dd>
<dt><strong><a name="gzip_libraries" class="item">Gzip libraries</a></strong></dt>
<dd>
<p>Late versions of MySQL come with support for compression. Thus
it <strong>may</strong> be required that you have install an RPM package like
libz-devel, libgz-devel or something similar.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="binary_installation">BINARY INSTALLATION</a></h1>
<p>Binary installation is possible in the most cases, depending
on your system. I give some examples:</p>
<p>
</p>
<h2><a name="windows">Windows</a></h2>
<p>ActivePerl offers a PPM archive of DBD::mysql. All you need to
do is typing</p>
<pre>
ppm
install DBI
install DBD-mysql</pre>
<p>This will fetch the modules via HTTP and install them. If you
need to use a WWW proxy server, the environment variable
HTTP_proxy must be set:</p>
<pre>
set HTTP_proxy=<a href="http://my.proxy.server:8000/">http://my.proxy.server:8000/</a>
ppm
install DBI
install DBD-mysql</pre>
<p>Of course you need to replace the host name <code>my.proxy.server</code>
and the port number <code>8000</code> with your local values.</p>
<p>If the above procedure doesn't work, please upgrade to the latest
version of ActivePerl. Versions before build 623 are known to
have problems.</p>
<p>PPM 3 is said to miss DBD::mysql in the repository. Thus use of
PPM 3 is discouraged, in favour of PPM 2. If you need to use
PPM 3, try</p>
<pre>
ppm
rep add PPM2 <a href="http://ppm.activestate.com/PPMPackages/5.6plus/">http://ppm.activestate.com/PPMPackages/5.6plus/</a>
rep 2
install DBI
install DBD-mysql</pre>
<p>
</p>
<h2><a name="red_hat_linux">Red Hat Linux</a></h2>
<p>As of version 7.1, Red Hat Linux comes with MySQL and DBD::mysql.
You need to ensure that the following RPM's are installed:</p>
<pre>
mysql
perl-DBI
perl-DBD-MySQL</pre>
<p>For installation from source the following RPM's are required</p>
<pre>
mysql-devel
libz-devel</pre>
<p>Optional are</p>
<pre>
mysql-server</pre>
<p>
</p>
<h2><a name="fedora_core_linux">Fedora Core Linux</a></h2>
<p>As of version 3, Fedora Linux comes with MySQL and DBD::mysql.
You need to ensure that the following RPM's are installed:</p>
<pre>
mysql or mysql-server
perl-DBD-MySQL</pre>
<p>For installation from source the following RPM's are required</p>
<pre>
mysql-devel
libz-devel</pre>
<p>Please try</p>
<pre>
yum search mysql</pre>
<p>To see the exact names</p>
<p>Note: (important) FC 3 comes with MySQL 3.x, and some people have
upgraded using MySQL RPMs for newer versions. If you do this, you
must re-compile you DBD::mysql because your existing DBD::mysql will be
linked against the old version of MySQL's client libs. CPAN has no way to
know or detect that you have upgraded MySQL.</p>
<p>
</p>
<h2><a name="other_systems">Other systems</a></h2>
<p>In the case of Linux or FreeBSD distributions it is very likely
that all you need comes with your distribution, as in the case
of Red Hat Linux. I just cannot give you names, as I am not using
these systems.</p>
<p>Please let me know if you find the files in your SuSE Linux, Debian
Linux or FreeBSD distribution so that I can extend the above list.</p>
<p>
</p>
<hr />
<h1><a name="source_installation">SOURCE INSTALLATION</a></h1>
<p>So you need to install from sources. If you are lucky, the Perl
module <code>CPAN</code> will do all for you, thanks to the excellent work
of Andreas Koenig. Otherwise you will need to do a manual
installation. Some of you, in particular system administrators
of multiple sites, will choose automatic installation. All of
these installation types have an own section. <a href="#cpan_installation">CPAN installation</a>.
<a href="#manual_installation">Manual installation</a>. <a href="#configuration">Configuration</a>.</p>
<p>The DBD::mysql Makefile.PL needs to know where to find your MySQL
installation. This may be achieved using command line switches
(see <a href="#configuration">Configuration</a>) or automatically using the mysql_config binary
which comes with most MySQL distributions. If your MySQL distribution
contains mysql_config the easiest method is to ensure this binary
is on your path.</p>
<pre>
e.g.</pre>
<pre>
PATH=$PATH:/usr/local/mysql/bin
export PATH</pre>
<p>
</p>
<h2><a name="cpan_installation">CPAN installation</a></h2>
<p>Installation of DBD::mysql can be incredibly easy:</p>
<pre>
cpan
install DBD::mysql</pre>
<p>If you are using the CPAN module for the first time, just answer
the questions by accepting the defaults which are fine in most
cases. If you are using an older version of Perl, you might
instead need a</p>
<pre>
perl -MCPAN -e shell
install DBD::mysql</pre>
<p>If you cannot get the CPAN module working, you might try manual
installation. If installation with CPAN fails because the your local
settings have been guessed wrong, you need to ensure MySQL's
mysql_config is on your path (see <a href="#source_installation">SOURCE INSTALLATION</a>) or
alternatively create a script called <code>mysql_config</code>. This is
described in more details later. <a href="#configuration">Configuration</a>.</p>
<p>
</p>
<h2><a name="manual_installation">Manual installation</a></h2>
<p>For a manual installation you need to fetch the DBD::mysql
source distribution. The latest version is always available
from</p>
<pre>
<a href="http://www.cpan.org/modules/by-module/DBD/">http://www.cpan.org/modules/by-module/DBD/</a></pre>
<p>The name is typically something like</p>
<pre>
DBD-mysql-1.2216.tar.gz</pre>
<p>The archive needs to be extracted. On Windows you may use a tool
like WinZip, on Unix you type</p>
<pre>
gzip -cd DBD-mysql-1.2216.tar.gz | tar xf -</pre>
<p>This will create a subdirectory DBD-mysql-1.2216. Enter this
subdirectory and type</p>
<pre>
perl Makefile.PL
make
make test</pre>
<p>(On Windows you may need to replace "make" with "nmake" or
"dmake".) If the tests seem to look fine, you may continue with</p>
<pre>
make install</pre>
<p>If the compilation (make) or tests fail, you might need to
configure some settings.</p>
<p>For example you might choose a different database, the C
compiler or the linker might need some flags. <a href="#configuration">Configuration</a>.
<a href="#compiler_flags">Compiler flags</a>. <a href="#linker_flags">Linker flags</a>.</p>
<p>For Windows/CygWin there is a special section below.
<em>Windows/CygWin</em>.</p>
<p>
</p>
<h2><a name="configuration">Configuration</a></h2>
<p>The install script "Makefile.PL" can be configured via a lot of
switches. All switches can be used on the command line. For
example, the test database:</p>
<pre>
perl Makefile.PL --testdb=<db></pre>
<p>If you do not like configuring these switches on the command
line, you may alternatively create a script called <code>mysql_config</code>.
This is described later on.</p>
<p>Available switches are:</p>
<dl>
<dt><strong><a name="testdb" class="item">testdb</a></strong></dt>
<dd>
<p>Name of the test database, defaults to <strong>test</strong>.</p>
</dd>
<dt><strong><a name="testuser" class="item">testuser</a></strong></dt>
<dd>
<p>Name of the test user, defaults to empty. If the name is empty,
then the currently logged in users name will be used.</p>
</dd>
<dt><strong><a name="testpassword" class="item">testpassword</a></strong></dt>
<dd>
<p>Password of the test user, defaults to empty.</p>
</dd>
<dt><strong><a name="testhost" class="item">testhost</a></strong></dt>
<dd>
<p>Host name or IP number of the test database; defaults to localhost.</p>
</dd>
<dt><strong><a name="testport" class="item">testport</a></strong></dt>
<dd>
<p>Port number of the test database</p>
</dd>
<dt><strong><a name="ps_protcol_1_or_0" class="item">ps-protcol=1 or 0</a></strong></dt>
<dd>
<p>Whether to run the test suite using server prepared statements or driver
emulated prepared statemetns. ps-protocol=1 means use server prepare,
ps-protocol=0 means driver emulated.</p>
</dd>
<dt><strong><a name="cflags" class="item">cflags</a></strong></dt>
<dd>
<p>This is a list of flags that you want to give to the C compiler.
The most important flag is the location of the MySQL header files.
For example, on Red Hat Linux the header files are in /usr/include/mysql
and you might try</p>
<pre>
-I/usr/include/mysql</pre>
<p>On Windows the header files may be in C:\mysql\include and you might try</p>
<pre>
-IC:\mysql\include</pre>
<p>The default flags are determined by running</p>
<pre>
mysql_config --cflags</pre>
<p>More details on the C compiler flags can be found in the following
section. <a href="#compiler_flags">Compiler flags</a>.</p>
</dd>
<dt><strong><a name="libs" class="item">libs</a></strong></dt>
<dd>
<p>This is a list of flags that you want to give to the linker
or loader. The most important flags are the locations and names
of additional libraries. For example, on Red Hat Linux your
MySQL client libraries are in /usr/lib/mysql and you might try</p>
<pre>
-L/usr/lib/mysql -lmysqlclient -lz</pre>
<p>On Windows the libraries may be in C:\mysql\lib and</p>
<pre>
-LC:\mysql\lib -lmysqlclient</pre>
<p>might be a good choice. The default flags are determined by running</p>
<pre>
mysql_config --libs</pre>
<p>More details on the linker flags can be found in a separate section.
<a href="#linker_flags">Linker flags</a>.</p>
</dd>
</dl>
<p>If a switch is not present on the command line, then the
script <code>mysql_config</code> will be executed. This script comes
as part of the MySQL distribution. For example, to determine
the C compiler flags, we are executing</p>
<pre>
mysql_config --cflags
mysql_config --libs</pre>
<p>If you want to configure your own settings for database name,
database user and so on, then you have to create a script with
the same name, that replies</p>
<pre>
=head2 Compiler flags</pre>
<p>Note: the folling info about compiler and linker flags, you shouldn't have
to use these options because Makefile.PL is pretty good at utilising
mysql_config to get the flags that you need for a successful compile.</p>
<p>It is typically not so difficult to determine the appropriate
flags for the C compiler. The linker flags, which you find in
the next section, are another story.</p>
<p>The determination of the C compiler flags is usually left to
a configuration script called <em class="file">mysql_config</em>, which can be
invoked with</p>
<pre>
mysql_config --cflags</pre>
<p>When doing so, it will emit a line with suggested C compiler
flags, for example like this:</p>
<pre>
-L/usr/include/mysql</pre>
<p>The C compiler must find some header files. Header files have
the extension <code>.h</code>. MySQL header files are, for example,
<em class="file">mysql.h</em> and <em class="file">mysql_version.h</em>. In most cases the header
files are not installed by default. For example, on Windows
it is an installation option of the MySQL setup program
(Custom installation), whether the header files are installed
or not. On Red Hat Linux, you need to install an RPM archive
<em class="file">mysql-devel</em> or <em class="file">MySQL-devel</em>.</p>
<p>If you know the location of the header files, then you will
need to add an option</p>
<pre>
-L<header directory></pre>
<p>to the C compiler flags, for example <code>-L/usr/include/mysql</code>.</p>
<p>
</p>
<h2><a name="linker_flags">Linker flags</a></h2>
<p>Appropriate linker flags are the most common source of problems
while installing DBD::mysql. I will only give a rough overview,
you'll find more details in the troubleshooting section.
<a href="#known_problems">KNOWN PROBLEMS</a></p>
<p>The determination of the C compiler flags is usually left to
a configuration script called <em class="file">mysql_config</em>, which can be
invoked with</p>
<pre>
mysql_config --libs</pre>
<p>When doing so, it will emit a line with suggested C compiler
flags, for example like this:</p>
<pre>
-L'/usr/lib/mysql' -lmysqlclient -lnsl -lm -lz -lcrypt</pre>
<p>The following items typically need to be configured for the
linker:</p>
<dl>
<dt><strong><a name="the_mysqlclient_library" class="item">The mysqlclient library</a></strong></dt>
<dd>
<p>The MySQL client library comes as part of the MySQL distribution.
Depending on your system it may be a file called</p>
<pre>
F<libmysqlclient.a> statically linked library, Unix
F<libmysqlclient.so> dynamically linked library, Unix
F<mysqlclient.lib> statically linked library, Windows
F<mysqlclient.dll> dynamically linked library, Windows</pre>
<p>or something similar.</p>
<p>As in the case of the header files, the client library is typically
not installed by default. On Windows you will need to select them
while running the MySQL setup program (Custom installation). On
Red Hat Linux an RPM archive <em class="file">mysql-devel</em> or <em class="file">MySQL-devel</em> must
be installed.</p>
<p>The linker needs to know the location and name of the mysqlclient
library. This can be done by adding the flags</p>
<pre>
-L<lib directory> -lmysqlclient</pre>
<p>or by adding the complete path name. Examples:</p>
<pre>
-L/usr/lib/mysql -lmysqlclient
-LC:\mysql\lib -lmysqlclient</pre>
<p>If you would like to use the static libraries (and there are
excellent reasons to do so), you need to create a separate
directory, copy the static libraries to that place and use
the -L switch above to point to your new directory. For example:</p>
<pre>
mkdir /tmp/mysql-static
cp /usr/lib/mysql/*.a /tmp/mysql-static
perl Makefile.PL --libs="-L/tmp/mysql-static -lmysqlclient"
make
make test
make install
rm -rf /tmp/mysql-static</pre>
</dd>
<dt><strong><a name="the_gzip_library" class="item">The gzip library</a></strong></dt>
<dd>
<p>The MySQL client can use compression when talking to the MySQL
server, a nice feature when sending or receiving large texts over
a slow network.</p>
<p>On Unix you typically find the appropriate file name by running</p>
<pre>
ldconfig -p | grep libz
ldconfig -p | grep libgz</pre>
<p>Once you know the name (libz.a or libgz.a is best), just add it
to the list of linker flags. If this seems to be causing problem
you may also try to link without gzip libraries.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="special_systems">SPECIAL SYSTEMS</a></h1>
<p>Below you find information on particular systems:</p>
<p>
</p>
<h2><a name="windows_cygwin">Windows/CygWin</a></h2>
<p>If you are a user of Cygwin (the Redhat distribution) you already
know, it contains a nicely running perl 5.6.1, installation of
additional modules usually works as a charme via the standard
procedure of</p>
<pre>
perl makefile.PL
make
make test
make install</pre>
<p>The Windows binary distribution of MySQL runs smoothly under Cygwin.
You can start/stop the server and use all Windows clients without problem.
But to install DBD::mysql you have to take a little special action.</p>
<p>Don't attempt to build DBD::mysql against either the MySQL Windows or
Linux/Unix BINARY distributions: neither will work!</p>
<p>You MUST compile the MySQL clients yourself under Cygwin, to get a
'libmysqlclient.a' compiled under Cygwin. Really! You'll only need
that library and the header files, you don't need any other client parts.
Continue to use the Windows binaries. And don't attempt (currently) to
build the MySQL Server part, it is unneccessary, as MySQL AB does an
excellent job to deliver optimized binaries for the mainstream
operating systems, and it is told, that the server compiled under Cygwin is
unstable.</p>
<p>Install MySQL (if you havn't already)</p>
<dl>
<dt><strong><a name="_" class="item">-</a></strong></dt>
<dd>
<p>download the MySQL Windows Binaries from
<a href="http://www.mysql.com/downloads/index.html">http://www.mysql.com/downloads/index.html</a></p>
</dd>
<dt><strong><a name="_2" class="item">-</a></strong></dt>
<dd>
<p>unzip mysql-<version>-win.zip into some temporary location</p>
</dd>
<dt><strong><a name="_3" class="item">-</a></strong></dt>
<dd>
<p>start the setup.exe there and follow the instructions</p>
</dd>
<dt><strong><a name="_4" class="item">-</a></strong></dt>
<dd>
<p>start the server</p>
</dd>
<dt><strong><a name="_5" class="item">-</a></strong></dt>
<dd>
<p>alternatively download, install and start the server on a remote
server, on what supported OS ever</p>
</dd>
</dl>
<p>Build MySQL clients under Cygwin:</p>
<dl>
<dt><strong><a name="_6" class="item">-</a></strong></dt>
<dd>
<p>download the MySQL LINUX source from
<a href="http://www.mysql.com/downloads/index.html">http://www.mysql.com/downloads/index.html</a></p>
</dd>
<dt><strong><a name="_7" class="item">-</a></strong></dt>
<dd>
<p>unpack mysql-<version>.tar.gz into some tmp location</p>
</dd>
<dt><strong><a name="_8" class="item">-</a></strong></dt>
<dd>
<p>cd into the unpacked dir mysql-<version></p>
<pre>
./configure --prefix=/usr/local/mysql --without-server</pre>
<p>This prepares the Makefile with the installed Cygwin features. It
takes some time, but should finish without error. The 'prefix', as
given, installs the whole Cygwin/MySQL thingy into a location not
normally in your PATH, so that you continue to use already installed
Windows binaries. The --without-server parameter tells configure to
only build the clients.</p>
</dd>
<dt><strong><a name="_9" class="item">-</a></strong></dt>
<dd>
<pre>
make</pre>
<p>This builds all MySQL client parts ... be patient. It should finish
finally without any error.</p>
</dd>
<dt><strong><a name="_10" class="item">-</a></strong></dt>
<dd>
<pre>
make install</pre>
<p>This installs the compiled client files under /usr/local/mysql/.
Remember, you don't need anything except the library under
/usr/local/mysql/lib and the headers under /usr/local/mysql/include!</p>
<p>Essentially you are now done with this part. If you want, you may try
your compiled binaries shortly; for that, do:</p>
</dd>
<dt><strong><a name="_11" class="item">-</a></strong></dt>
<dd>
<pre>
cd /usr/local/mysql/bin
./mysql -h 127.0.0.1</pre>
<p>The host (-h) parameter 127.0.0.1 targets the local host, but forces
the mysql client to use a TCP/IP connection. The default would be a
pipe/socket connection (even if you say '-h localhost') and this
doesn't work between Cygwin and Windows (as far as I know).</p>
<p>If you have your MySQL server running on some other box, then please
substitute '127.0.0.1' with the name or IP-number of that box.</p>
</dd>
</dl>
<p>Please note, in my environment the 'mysql' client did not accept a
simple RETURN, I had to use CTRL-RETURN to send commands
... strange,
but I didn't attempt to fix that, as we are only interested in the
built lib and headers.</p>
<p>At the 'mysql>' prompt do a quick check:</p>
<pre>
mysql> use mysql
mysql> show tables;
mysql> select * from db;
mysql> exit</pre>
<p>You are now ready to build DBD::mysql!</p>
<p>Build DBD::mysql:</p>
<dl>
<dt><strong><a name="_12" class="item">-</a></strong></dt>
<dd>
<p>download DBD-mysql-<version>.tar.gz from CPAN</p>
</dd>
<dt><strong><a name="_13" class="item">-</a></strong></dt>
<dd>
<p>unpack DBD-mysql-<version>.tar.gz</p>
</dd>
<dt><strong><a name="_14" class="item">-</a></strong></dt>
<dd>
<p>cd into unpacked dir DBD-mysql-<version>
you probably did that already, if you are reading this!</p>
</dd>
<dt><strong><a name="_15" class="item">-</a></strong></dt>
<dd>
<pre>
cp /usr/local/mysql/bin/mysql_config .</pre>
<p>This copies the executable script mentioned in the DBD::mysql docs
from your just built Cywin/MySQL client directory; it knows about
your Cygwin installation, especially about the right libraries to link
with.</p>
</dd>
<dt><strong><a name="_16" class="item">-</a></strong></dt>
<dd>
<pre>
perl Makefile.PL --testhost=127.0.0.1</pre>
<p>The --testhost=127.0.0.1 parameter again forces a TCP/IP connection
to the MySQL server on the local host instead of a pipe/socket
connection for the 'make test' phase.</p>
</dd>
<dt><strong><a name="_17" class="item">-</a></strong></dt>
<dd>
<pre>
make</pre>
<p>This should run without error</p>
</dd>
<dt><strong><a name="_18" class="item">-</a></strong></dt>
<dd>
<pre>
make test</pre>
<p>with DBD-mysql-2.1022 or earlier you will see several errors in
dbdadmin.t, mysql.t and mysql2.t; with later versions you should not
get errors (except possibly one, indicating, that some tables could
not be dropped. I'm hunting for a solution to that problem, but have
none yet).</p>
</dd>
<dt><strong><a name="_19" class="item">-</a></strong></dt>
<dd>
<pre>
make install</pre>
<p>This installs DBD::mysql into the Perl hierarchy.</p>
</dd>
</dl>
<p>Notes:</p>
<p>This was tested with MySQL version 3.23.54a and DBD::mysql version
2.1022. I patched the above mentioned test scripts and sent the
patches
to the author of DBD::mysql Jochen Wiedman.</p>
<p>Georg Rehfeld 15. Jan. 2003</p>
<p>
</p>
<hr />
<h1><a name="known_problems">KNOWN PROBLEMS</a></h1>
<ol>
<li><strong><a name="_" class="item">)</a></strong>
<p>Some Linux distributions don't come with a gzip library by default.
Running "make" terminates with an error message like</p>
<pre>
LD_RUN_PATH="/usr/lib/mysql:/lib:/usr/lib" gcc
-o blib/arch/auto/DBD/mysql/mysql.so -shared
-L/usr/local/lib dbdimp.o mysql.o -L/usr/lib/mysql
-lmysqlclient -lm -L/usr/lib/gcc-lib/i386-redhat-linux/2.96
-lgcc -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/DBD/mysql/mysql.so] Error 1</pre>
<p>If this is the case for you, install an RPM archive like
libz-devel, libgz-devel, zlib-devel or gzlib-devel or something
similar.</p>
</li>
<li><strong><a name="_2" class="item">)</a></strong>
<p>If Perl was compiled with gcc or egcs, but MySQL was compiled
with another compiler or on another system, an error message like
this is very likely when running "Make test":</p>
<pre>
t/00base............install_driver(mysql) failed: Can't load
'../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql:
../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol: _umoddi3
at /usr/local/perl-5.005/lib/5.005/i586-linux-thread/DynaLoader.pm
line 168.</pre>
<p>This means, that your linker doesn't include libgcc.a. You have
the following options:</p>
<p>The solution is telling the linker to use libgcc. Run</p>
<pre>
gcc --print-libgcc-file</pre>
<p>to determine the exact location of libgcc.a or for older versions
of gcc</p>
<pre>
gcc -v</pre>
<p>to determine the directory. If you know the directory, add a</p>
<pre>
-L<directory> -lgcc</pre>
<p>to the list of C compiler flags. <a href="#configuration">Configuration</a>. <a href="#linker_flags">Linker flags</a>.</p>
</li>
<li><strong><a name="_3" class="item">)</a></strong>
<p>There are known problems with shared versions of libmysqlclient,
at least on some Linux boxes. If you receive an error message
similar to</p>
<pre>
install_driver(mysql) failed: Can't load
'/usr/lib/perl5/site_perl/i586-linux/auto/DBD/mysql/mysql.so'
for module DBD::mysql: File not found at
/usr/lib/perl5/i586-linux/5.00404/DynaLoader.pm line 166</pre>
<p>then this error message can be misleading: It's not mysql.so
that fails being loaded, but libmysqlclient.so! The usual
problem is that this file is located in a directory like</p>
<pre>
/usr/lib/mysql</pre>
<p>where the linker doesn't look for it.</p>
<p>The best workaround is using a statically linked mysqlclient
library, for example</p>
<pre>
/usr/lib/mysql/libmysqlclient.a</pre>
<p>The use of a statically linked library is described in the
previous section on linker flags. <a href="#configuration">Configuration</a>.
<a href="#linker_flags">Linker flags</a>.</p>
</li>
<li><strong><a name="_4" class="item">)</a></strong>
<p>Red Hat 8 & 9 set the Default locale to UTF which causes problems with
MakeMaker. To build DBD::mysql on these systems, do a 'unset LANG'
before runing 'perl Makefile.PL'</p>
</li>
</ol>
<p>
</p>
<hr />
<h1><a name="support">SUPPORT</a></h1>
<p>Finally, if everything else fails, you are not alone. First of
all, for an immediate answer, you should look into the archives
of the mailing list <strong><a href="mailto:[email protected]">[email protected]</a></strong>. See
<a href="http://www.mysql.com">http://www.mysql.com</a> for archive locations.</p>
<p>If you don't find an appropriate posting and reply in the
mailing list, please post a question. Typically a reply will
be seen within one or two days.</p>
</body>
</html>