Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I finally got DBD::mysql installed, and I was able to run a test program successfully. Here is what I did: 1) Repaired permissions. The directory /Users/7stud/.cpan is the top of the directory hierarchy that perlbrew uses to install my modules. I must have done a: $ sudo cpan Some::Moduleat some point because some of the sub directories under /Users/7stud/.cpan were owned by root--because they were created by root. However, all the sub directories need to be owned by 7stud in order for me to install modules without using sudo--otherwise I get Permission Denied errors when installing some modules. To change all the permissions in the .cpan directory and all sub directories, I used this command:
Note the dot at the end of the command, which denotes the current directory. That command says to recursively change ownership of all the files in the current directory and below to the user 7stud, which is as it should be. 2) Fixed libmysqlclient.18.dylib problem. At this link, there is a tip about curing the libmysqlclient.18.dylib problem noted in the output: Library not loaded: libmysqlclient.18.dylibAt the link, it says that if you do this:
(Note the backticks) then the output will indicate something is not right. To fix the problem, the person says to do this:
Note that everything is part of the command (Yes, the same directory is repeated twice). Adjust the command for your mysql version and libmysqlclient.<number here>.dylib. 3) Created a new mysql user so that DBD::mysql could perform database tests. After I performed 1) and 2), the DBD::mysql install failed because tests couldn't be performed. Somewhere in the output it said to do this:
On previous attempts to install DBD::mysql, I was told to do the same thing with root:
In any case, I started mysql:
Then I opened up a mysql shell:
And then I used the line from the DBD::mysql output: That created the mysql user 7stud with the password 's3kr1t' and granted 7stud privileges to use the 'test' database, which was created by mysql on installation. By creating the mysql user indicated in the output, you are letting DBD::mysql access mysql to perform tests. 4) Installed DBD::mysql:
EDIT: I mistakenly installed DBD::mysql into my perl-5.16.0t(compiled with threads) instead of my perl-5.16.0 which is where I wanted to install DBD::mysql. So I switched to 5.16.0:
...but once again I had installation problems: $ cpan DBD::mysql CPAN: Storable loaded ok (v2.34) Reading '/Users/7stud/.cpan/Metadata' Database was generated on Wed, 16 Jan 2013 19:07:11 GMT CPAN: YAML loaded ok (v0.84) Reading 51 yaml files from /Users/7stud/.cpan/build/ CPAN: Time::HiRes loaded ok (v1.9725) ............................................................................DONE Restored the state of 1 (in 0.7206 secs) Running install for module 'DBD::mysql' Running make for C/CA/CAPTTOFU/DBD-mysql-4.022.tar.gz Prepending /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/arch /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/lib to PERL5LIB for 'get' Has already been unwrapped into directory /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe Prepending /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/arch /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/lib to PERL5LIB for 'make' CPAN: Parse::CPAN::Meta loaded ok (v1.4402) CPAN: CPAN::Meta loaded ok (v2.120630) CPAN: Module::CoreList loaded ok (v2.79) Has already been made Prepending /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/arch /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/lib to PERL5LIB for 'test' Running make test Has already been tested successfully Running make install Already tried without success $ That's a pretty frustrating result since DBD::mysql was "tested successfully". I finally resorted to the nuclear option:
In hindsight, I think I should have used even a bigger gun:
fforce makes cpan forget anything it has done before when trying to install a module and start the install from scratch. Here was the output: $ cpan -f -i DBD::mysql CPAN: Storable loaded ok (v2.34) Reading '/Users/7stud/.cpan/Metadata' Database was generated on Wed, 16 Jan 2013 19:07:11 GMT CPAN: YAML loaded ok (v0.84) Reading 51 yaml files from /Users/7stud/.cpan/build/ CPAN: Time::HiRes loaded ok (v1.9725) ............................................................................DONE Restored the state of 1 (in 0.7274 secs) Running install for module 'DBD::mysql' Running make for C/CA/CAPTTOFU/DBD-mysql-4.022.tar.gz Prepending /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/arch /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/lib to PERL5LIB for 'get' Has already been unwrapped into directory /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe Prepending /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/arch /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/lib to PERL5LIB for 'make' CPAN: Parse::CPAN::Meta loaded ok (v1.4402) CPAN: CPAN::Meta loaded ok (v2.120630) CPAN: Module::CoreList loaded ok (v2.79) Has already been made Prepending /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/arch /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/lib to PERL5LIB for 'test' Running make test Has already been tested successfully Running make install Prepending /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/arch /Users/7stud/.cpan/build/DBD-mysql-4.022-LOppYe/blib/lib to PERL5LIB for 'install' Files found in blib/arch: installing files in blib/lib into architecture dependent library tree Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/auto/DBD/mysql/mysql.bs Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/auto/DBD/mysql/mysql.bundle Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/Bundle/DBD/mysql.pm Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/DBD/mysql.pm Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/DBD/mysql/GetInfo.pm Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/DBD/mysql/INSTALL.pod Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/man/man3/Bundle::DBD::mysql.3 Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/man/man3/DBD::mysql.3 Installing /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/man/man3/DBD::mysql::INSTALL.3 Appending installation info to /Users/7stud/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/darwin-2level/perllocal.pod CAPTTOFU/DBD-mysql-4.022.tar.gz /usr/bin/make install -- OK 5) I tested the DBI install with the following program (substitute in your own user, password, db, table, and column names):
If you don't know how to create a mysql db, add a table, and insert some data, here are some commands to help you in that regard:
In reply to Re: DBD::mysql won't install
by 7stud
|
|