⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbd::mysql::install.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.Vb 1\&  \-I/usr/include/mysql.Ve.SpOn Windows the header files may be in C:\emysql\einclude and you might try.Sp.Vb 1\&  \-IC:\emysql\einclude.Ve.SpThe default flags are determined by running.Sp.Vb 1\&  mysql_config \-\-cflags.Ve.SpMore details on the C compiler flags can be found in the followingsection. \*(L"Compiler flags\*(R"..IP "libs" 4.IX Item "libs"This is a list of flags that you want to give to the linkeror loader. The most important flags are the locations and namesof additional libraries. For example, on Red Hat Linux yourMySQL client libraries are in /usr/lib/mysql and you might try.Sp.Vb 1\&  \-L/usr/lib/mysql \-lmysqlclient \-lz.Ve.SpOn Windows the libraries may be in C:\emysql\elib and.Sp.Vb 1\&  \-LC:\emysql\elib \-lmysqlclient.Ve.Spmight be a good choice. The default flags are determined by running.Sp.Vb 1\&  mysql_config \-\-libs.Ve.SpMore details on the linker flags can be found in a separate section.\&\*(L"Linker flags\*(R"..PPIf a switch is not present on the command line, then thescript \f(CW\*(C`mysql_config\*(C'\fR will be executed. This script comesas part of the MySQL distribution. For example, to determinethe C compiler flags, we are executing.PP.Vb 2\&  mysql_config \-\-cflags\&  mysql_config \-\-libs.Ve.PPIf you want to configure your own settings for database name,database user and so on, then you have to create a script withthe same name, that replies.Sh "Compiler flags".IX Subsection "Compiler flags"Note: the folling info about compiler and linker flags, you shouldn't haveto use these options because Makefile.PL is pretty good at utilisingmysql_config to get the flags that you need for a successful compile..PPIt is typically not so difficult to determine the appropriateflags for the C compiler. The linker flags, which you find inthe next section, are another story..PPThe determination of the C compiler flags is usually left toa configuration script called \fImysql_config\fR, which can beinvoked with.PP.Vb 1\&  mysql_config \-\-cflags.Ve.PPWhen doing so, it will emit a line with suggested C compilerflags, for example like this:.PP.Vb 1\&  \-L/usr/include/mysql.Ve.PPThe C compiler must find some header files. Header files havethe extension \f(CW\*(C`.h\*(C'\fR. MySQL header files are, for example,\&\fImysql.h\fR and \fImysql_version.h\fR. In most cases the headerfiles are not installed by default. For example, on Windowsit is an installation option of the MySQL setup program(Custom installation), whether the header files are installedor not. On Red Hat Linux, you need to install an \s-1RPM\s0 archive\&\fImysql-devel\fR or \fIMySQL-devel\fR..PPIf you know the location of the header files, then you willneed to add an option.PP.Vb 1\&  \-L<header directory>.Ve.PPto the C compiler flags, for example \f(CW\*(C`\-L/usr/include/mysql\*(C'\fR..Sh "Linker flags".IX Subsection "Linker flags"Appropriate linker flags are the most common source of problemswhile installing DBD::mysql. I will only give a rough overview,you'll find more details in the troubleshooting section.\&\*(L"\s-1KNOWN\s0 \s-1PROBLEMS\s0\*(R".PPThe determination of the C compiler flags is usually left toa configuration script called \fImysql_config\fR, which can beinvoked with.PP.Vb 1\&  mysql_config \-\-libs.Ve.PPWhen doing so, it will emit a line with suggested C compilerflags, for example like this:.PP.Vb 1\&   \-L\*(Aq/usr/lib/mysql\*(Aq \-lmysqlclient \-lnsl \-lm   \-lz \-lcrypt.Ve.PPThe following items typically need to be configured for thelinker:.IP "The mysqlclient library" 4.IX Item "The mysqlclient library"The MySQL client library comes as part of the MySQL distribution.Depending on your system it may be a file called.Sp.Vb 4\&  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.Ve.Spor something similar..SpAs in the case of the header files, the client library is typicallynot installed by default. On Windows you will need to select themwhile running the MySQL setup program (Custom installation). OnRed Hat Linux an \s-1RPM\s0 archive \fImysql-devel\fR or \fIMySQL-devel\fR mustbe installed..SpThe linker needs to know the location and name of the mysqlclientlibrary. This can be done by adding the flags.Sp.Vb 1\&  \-L<lib directory> \-lmysqlclient.Ve.Spor by adding the complete path name. Examples:.Sp.Vb 2\&  \-L/usr/lib/mysql \-lmysqlclient\&  \-LC:\emysql\elib \-lmysqlclient.Ve.SpIf you would like to use the static libraries (and there areexcellent reasons to do so), you need to create a separatedirectory, copy the static libraries to that place and usethe \-L switch above to point to your new directory. For example:.Sp.Vb 7\&  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.Ve.IP "The gzip library" 4.IX Item "The gzip library"The MySQL client can use compression when talking to the MySQLserver, a nice feature when sending or receiving large texts overa slow network..SpOn Unix you typically find the appropriate file name by running.Sp.Vb 2\&  ldconfig \-p | grep libz\&  ldconfig \-p | grep libgz.Ve.SpOnce you know the name (libz.a or libgz.a is best), just add itto the list of linker flags. If this seems to be causing problemyou may also try to link without gzip libraries..SH "SPECIAL SYSTEMS".IX Header "SPECIAL SYSTEMS"Below you find information on particular systems:.Sh "Windows/CygWin".IX Subsection "Windows/CygWin"If you are a user of Cygwin (the Redhat distribution) you alreadyknow, it contains a nicely running perl 5.6.1, installation ofadditional modules usually works as a charme via the standardprocedure of.PP.Vb 4\&    perl makefile.PL\&    make\&    make test\&    make install.Ve.PPThe 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..PPDon't attempt to build DBD::mysql against either the MySQL Windows orLinux/Unix \s-1BINARY\s0 distributions: neither will work!.PPYou \s-1MUST\s0 compile the MySQL clients yourself under Cygwin, to get a\&'libmysqlclient.a' compiled under Cygwin. Really! You'll only needthat library and the header files, you don't need any other client parts.Continue to use the Windows binaries. And don't attempt (currently) tobuild the MySQL Server part, it is unneccessary, as MySQL \s-1AB\s0 does anexcellent job to deliver optimized binaries for the mainstreamoperating systems, and it is told, that the server compiled under Cygwin isunstable..PPInstall MySQL (if you havn't already).IP "\-" 4download the MySQL Windows Binaries fromhttp://www.mysql.com/downloads/index.html.IP "\-" 4unzip mysql\-<version>\-win.zip into some temporary location.IP "\-" 4start the setup.exe there and follow the instructions.IP "\-" 4start the server.IP "\-" 4alternatively download, install and start the server on a remoteserver, on what supported \s-1OS\s0 ever.PPBuild MySQL clients under Cygwin:.IP "\-" 4download the MySQL \s-1LINUX\s0 source fromhttp://www.mysql.com/downloads/index.html.IP "\-" 4unpack mysql\-<version>.tar.gz into some tmp location.IP "\-" 4cd into the unpacked dir mysql\-<version>.Sp.Vb 1\&  ./configure \-\-prefix=/usr/local/mysql \-\-without\-server.Ve.SpThis prepares the Makefile with the installed Cygwin features. Ittakes some time, but should finish without error. The 'prefix', asgiven, installs the whole Cygwin/MySQL thingy into a location notnormally in your \s-1PATH\s0, so that you continue to use already installedWindows binaries. The \-\-without\-server parameter tells configure toonly build the clients..IP "\-" 4.Vb 1\&  make.Ve.SpThis builds all MySQL client parts ... be patient. It should finishfinally without any error..IP "\-" 4.Vb 1\&  make install.Ve.SpThis 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!.SpEssentially you are now done with this part. If you want, you may tryyour compiled binaries shortly; for that, do:.IP "\-" 4.Vb 2\&  cd /usr/local/mysql/bin\&  ./mysql \-h 127.0.0.1.Ve.SpThe host (\-h) parameter 127.0.0.1 targets the local host, but forcesthe mysql client to use a \s-1TCP/IP\s0 connection. The default would be apipe/socket connection (even if you say '\-h localhost') and thisdoesn't work between Cygwin and Windows (as far as I know)..SpIf you have your MySQL server running on some other box, then pleasesubstitute '127.0.0.1' with the name or IP-number of that box..PPPlease note, in my environment the 'mysql' client did not accept asimple \s-1RETURN\s0, I had to use CTRL-RETURN to send commands\&... strange,but I didn't attempt to fix that, as we are only interested in thebuilt lib and headers..PPAt the 'mysql>' prompt do a quick check:.PP.Vb 4\&  mysql> use mysql\&  mysql> show tables;\&  mysql> select * from db;\&  mysql> exit.Ve.PPYou are now ready to build DBD::mysql!.PPBuild DBD::mysql:.IP "\-" 4download DBD\-mysql\-<version>.tar.gz from \s-1CPAN\s0.IP "\-" 4unpack DBD\-mysql\-<version>.tar.gz.IP "\-" 4cd into unpacked dir DBD\-mysql\-<version>you probably did that already, if you are reading this!.IP "\-" 4.Vb 1\&  cp /usr/local/mysql/bin/mysql_config ..Ve.SpThis copies the executable script mentioned in the DBD::mysql docsfrom your just built Cywin/MySQL client directory; it knows aboutyour Cygwin installation, especially about the right libraries to linkwith..IP "\-" 4.Vb 1\&  perl Makefile.PL \-\-testhost=127.0.0.1.Ve.SpThe \-\-testhost=127.0.0.1 parameter again forces a \s-1TCP/IP\s0 connectionto the MySQL server on the local host instead of a pipe/socketconnection for the 'make test' phase..IP "\-" 4.Vb 1\&  make.Ve.SpThis should run without error.IP "\-" 4.Vb 1\&  make test.Ve.Spwith DBD\-mysql\-2.1022 or earlier you will see several errors indbdadmin.t, mysql.t and mysql2.t; with later versions you should notget errors (except possibly one, indicating, that some tables couldnot be dropped. I'm hunting for a solution to that problem, but havenone yet)..IP "\-" 4.Vb 1\&  make install.Ve.SpThis installs DBD::mysql into the Perl hierarchy..PPNotes:.PPThis was tested with MySQL version 3.23.54a and DBD::mysql version2.1022. I patched the above mentioned test scripts and sent thepatchesto the author of DBD::mysql Jochen Wiedman..PPGeorg Rehfeld          15. Jan. 2003.SH "KNOWN PROBLEMS".IX Header "KNOWN PROBLEMS".IP "1.)" 4.IX Item "1.)"Some Linux distributions don't come with a gzip library by default.Running \*(L"make\*(R" terminates with an error message like.Sp.Vb 8\&  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.Ve.SpIf this is the case for you, install an \s-1RPM\s0 archive likelibz-devel, libgz-devel, zlib-devel or gzlib-devel or somethingsimilar..IP "2.)" 4.IX Item "2.)"If Perl was compiled with gcc or egcs, but MySQL was compiledwith another compiler or on another system, an error message likethis is very likely when running \*(L"Make test\*(R":.Sp.Vb 5\&  t/00base............install_driver(mysql) failed: Can\*(Aqt load\&  \*(Aq../blib/arch/auto/DBD/mysql/mysql.so\*(Aq 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..Ve.SpThis means, that your linker doesn't include libgcc.a. You havethe following options:.SpThe solution is telling the linker to use libgcc. Run.Sp.Vb 1\&  gcc \-\-print\-libgcc\-file.Ve.Spto determine the exact location of libgcc.a or for older versionsof gcc.Sp.Vb 1\&  gcc \-v.Ve.Spto determine the directory. If you know the directory, add a.Sp.Vb 1\&  \-L<directory> \-lgcc.Ve.Spto the list of C compiler flags. \*(L"Configuration\*(R". \*(L"Linker flags\*(R"..IP "3.)" 4.IX Item "3.)"There are known problems with shared versions of libmysqlclient,at least on some Linux boxes. If you receive an error messagesimilar to.Sp.Vb 4\&  install_driver(mysql) failed: Can\*(Aqt load\&  \*(Aq/usr/lib/perl5/site_perl/i586\-linux/auto/DBD/mysql/mysql.so\*(Aq\&  for module DBD::mysql: File not found at\&  /usr/lib/perl5/i586\-linux/5.00404/DynaLoader.pm line 166.Ve.Spthen this error message can be misleading: It's not mysql.sothat fails being loaded, but libmysqlclient.so! The usualproblem is that this file is located in a directory like.Sp.Vb 1\&  /usr/lib/mysql.Ve.Spwhere the linker doesn't look for it..SpThe best workaround is using a statically linked mysqlclientlibrary, for example.Sp.Vb 1\&  /usr/lib/mysql/libmysqlclient.a.Ve.SpThe use of a statically linked library is described in theprevious section on linker flags. \*(L"Configuration\*(R".\&\*(L"Linker flags\*(R"..IP "4.)" 4.IX Item "4.)"Red Hat 8 & 9 set the Default locale to \s-1UTF\s0 which causes problems with MakeMaker.  To build DBD::mysql on these systems, do a 'unset \s-1LANG\s0' before runing 'perl Makefile.PL'.SH "SUPPORT".IX Header "SUPPORT"Finally, if everything else fails, you are not alone. First ofall, for an immediate answer, you should look into the archivesof the mailing list \fBperl@lists.mysql.com\fR. Seehttp://www.mysql.com for archive locations..PPIf you don't find an appropriate posting and reply in themailing list, please post a question. Typically a reply willbe seen within one or two days.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -