Tuesday, December 11, 2012

Simple setting of MySQL server for user's prefix

Few MySQL commands that I need:

  • connect to database
    mysql --user=root mysql -p
  • create db user 'paja' for connecting to localhost and also from outside
    CREATE USER 'paja'@'localhost' IDENTIFIED BY 'paja-password';
    CREATE USER 'paja'@'%' IDENTIFIED BY 'paja-password'; 
  • grant privileges to create databases with prefix 'paja_'
    GRANT ALL PRIVILEGES ON `paja\_%` . * TO 'paja'@'localhost';
    GRANT ALL PRIVILEGES ON `paja\_%` . * TO 'paja'@'%'
    ;
  • modify /etc/mysql/my.cnf by comment line
    bind-address           = 127.0.0.1
    that makes MySQL server listening only on localhost
  • test connection from localhost and from different host
    mysql --user=paja -h localhost -p
    mysql --user=paja -h myhost.address -p

Friday, September 7, 2012

Perl modules

You have already met this
Can't locate PerlIO/gzip.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ...
because sometimes you have to install perl modules in non-standard folders (e.g. you are not root at the machine). How to solve it?

There is guide how to install perl module to specified folder
http://modperlbook.org/html/3-9-1-Installing-Perl-Modules-into-a-Nonstandard-Directory.html
In few steps:

perl Makefile.PL PREFIX=/your/folder
make
make install


  • export variable PERL5LIB to /your/folder/lib/perl/5.10.1
Now it should work.

To see what is in your @INC, run

perl -V
To test your module run
perl -Mmodule_name -e ''