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