Install DBD::mysql for Perl in XAMPP in Mac , solving errors
我不知道 why,在 Mac 安装 DBI::mysql 总会报错
我为了给 cgi-bin 添加 mysql-perl 数据库支持,也是够麻烦的
- make sure that mysql and mydql_config is in your PATH
也就是命令行
which mysql
和which mysql_config
都可以得到路径
- edit mysql_config
sudo vi $(which mysql_config)
要修改几个地方,确保几处环境设置正确
- line95: pkgincludedir='/Applications/XAMPP/xamppfiles/include'
- line113: include="$include -I/usr/include/php/ext/mysqlnd"
- install DBD::mysql using XAMPP cpan
sudo /Applications/XAMPP/xamppfiles/bin/cpaninstall DBD::mysql
- test if success install
/Applications/XAMPP/xamppfiles/bin/perl -MDBD::mysql -e1
如果没有输出表示成功了
第一个依赖错误
Can't load '/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Reason: image not found at /System/Library/Perl/5.18/darwin-thread-multi-2level/DynaLoader.pm line 194.
at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.
- locate libmysqlclient
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.a
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.dylib
/Applications/XAMPP/xamppfiles/lib/libmysqlclient_r.18.dylib
/Applications/XAMPP/xamppfiles/lib/libmysqlclient_r.a
/Applications/XAMPP/xamppfiles/lib/libmysqlclient_r.dylib
build linkage
sudo ln -s /Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo ln -s /Applications/XAMPP/xamppfiles/lib/libmysqlclient.a /usr/lib/libmysqlclient.a
check again
/Applications/XAMPP/xamppfiles/bin/perl -MDBD::mysql -e1
test online
1 #!/usr/bin/perl
2
3 use utf8;
4 use v5.16;
5 use warnings;
6 use DBI;
7 print "Content-type: text/plain; charset=utf-8\n\n";
8 print "$_\n" for (DBI->available_drivers);
9 # mysql SQLite File DBM are supported
10 print "----------\nInstalled\n\n";
11 my %ins = DBI->installed_drivers();
12 print "$_\t$ins{$_}\n" foreach (sort keys %ins);
13
14 my $mydbh = DBI->connect('DBI:mysql:test;host=localhost','root','imac@mysql') or die "connect failed";
15 my $sth = $mydbh->prepare("select * from test;");
16 $sth->execute();
17 #$result = $sth->fetchrow_hashref();
18 while( $result = $sth->fetchrow_hashref ){
19 for (keys $result){
20 print "$_\t$result->{$_}\n";
21 }}
22 $mydbh->disconnect();
how to make CGI-Perl to work with Apache
• edit /Applications/XAMPP/xamppfiles/etc/httpd.conf
375 <Directory "/Applications/XAMPP/xamppfiles/cgi-bin">
376 AllowOverride all
377 Options ExecCGI Includes Indexes
378 # +/- no need
379 #AddHandler cgi-script .cgi .pl .py .sh
380 Order deny,allow
381 Allow from all
382 Require all granted
383 # allow and require are must
384 </Directory>
- 419 AddHandler cgi-script .cgi .pl .py .sh
- sudo chmod -R 0755 /Applications/XAMPP/xamppfiles/cgi-bin
- restart apache
Install DBD::mysql for Perl in XAMPP in Mac , solving errors的更多相关文章
- Install MongoDB driver for PHP on XAMPP for Mac OSX
试了不少方法,最后还是这个最有效. [转自:http://thatsimplecode.com/install-mongodb-driver-for-php-on-xampp-for-mac-osx] ...
- centos perl: symbol lookup error: /usr/local/lib64/perl5/auto/DBD/mysql/mysql.so: undefined symbol: mysql_init
之前在安装天兔数据库监控工具lepus的时候,运行时一直报perl: symbol lookup error: /usr/local/lib64/perl5/auto/DBD/mysql/mysql. ...
- XAMPP Apache + MySQL + PHP + Perl
XAMPP Apache + MySQL + PHP + Perl 什么是XAMPP? XAMPP是最流行的PHP开发环境 XAMPP是完全免费且易于安装的Apache发行版,其中包含MySQL.PH ...
- percona innobackupex 遇到 connect to MySQL server as DBD::mysql module is not installed 问题
percona innobackupex connect to MySQL server as DBD::mysql module is not installed [root@mysql softw ...
- MySQL MHA /usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln301] install_driver(mysql) failed: Attempt to reload DBD/mysql.pm aborted
在公司随便找3台测试机搭个MHA,下面这个问题折腾了三天,之前没遇到过,查了OS版本发现一致,可能是不同人弄的OS吧,知道是cpan的问题就是搞不定,郁闷...[root@test247 ~]# ma ...
- Failed to connect to MySQL server as DBD::mysql module is not installed 问题的解决
部署PXC ,卸了旧的MySQL perl-DBD-MySQL-4.013-3.el6.x86_64 这个包已经安装了,innobackup时一直在报错: Failed to connect to M ...
- 如何处理错误消息Please install the gcc make perl packages
如何处理这行错误消息? Please install the gcc make perl packages from your distribution. 执行命令行:yum install gcc ...
- 【错误】:MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
错误:MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决 ...
- 【mysql报错】MySQL host is blocked because of many connection errors; 解决方法
MySQL host is blocked because of many connection errors; 报错 环境 操作系统:Linux 数据库:mysql5.7.27 错误提示 jHost ...
随机推荐
- 玩转HTML5移动页面
(1) 动画雪碧图涉及的动画十分多,用的元素也十分多,请务必使用雪碧图(Sprite)!网上的工具有一些可以帮助你生成雪碧图的工具,例如CssGaga,GoPng等等,自动化构建工具Grunt和Gul ...
- 实践JAVA wait(), notify(),sleep方法--一道多线程的面试题
建立三个线程,A线程打印10次A,B线程打印10次B,C线程打印10次C,要求线程同时运行,交替打印10次ABC. 这个问题用Object的wait(),notify()就可以很方便的解决. publ ...
- PISA
http://www.oecd.org/pisa/ 国际学生评估 PISA类测试:一种国际性的科学的评价方法,可强化对考生知识面.综合分析.创新素养方面的考查. 评估内容 第一次PISA评估于2000 ...
- 商业智能BI和ERP的融合之路
企业在发展过程中为了更好的跟上同行业的步伐,甚至是为了在众多企业中脱颖而出,他们会主动寻求全面的企业解决方案.但是由于行业的快速发展,需求的不断增长,市面上的智能软件层出不穷,这也给了企业选择的困难. ...
- 发布自己的nuget包;报错source parameter was not specified
16-10-27 VS下使用 程序包管理器控制台 运行: 1.cd 命令走到 工程文件夹下,使用 ls 命令查看当前目录: 2. 使用 nuget spec 创建: 3. 使用 nuget pack ...
- SQL将一张表中的数据插入到另一张表
将表T_wz_wz中的部分数据插入到表t_wz_kc: ,,'Y' from t_wz_wz where yxbz='Y' --去重复 -- and wzid not in (select wzid ...
- PLSQL 的简单命令之三
-- 查找两个表中ID相等的 select a.id, a.name,b.math from stu a,scores b where a.id = b.id -- 右外连接 select b.id, ...
- RAC和ASM环境下修改控制文件control file
1,目前控制文件只有一个,为了安全性,增加到3个 SQL> select name from v$controlfile; NAME ------------------------------ ...
- ORA-16179: incremental changes to "log_archive_dest_1" not allowed with SPFILE
SQL> alter system set log_archive_dest_1='E:\arch ' scope=both; alter system set log_archive_dest ...
- Java基础之泛型——使用泛型链表类型(TryGenericLinkedList)
控制台程序 定义Point类: public class Point { // Create a point from its coordinates public Point(double xVal ...