/Users/7stud/.cpan$ sudo chown -R 7stud .
####
$ otool -D `mdfind libmysqlclient.18.dylib`
##
##
$ sudo install_name_tool -id /usr/local/mysql-5.5.28-osx10.6-x86_64/lib/libmysqlclient.18.dylib
/usr/local/mysql-5.5.28-osx10.6-x86_64/lib/libmysqlclient.18.dylib
##
##
mysql> grant all privileges on test.* to '7stud'@'localhost' identified by 's3kr1t';
##
##
mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';
##
##
$ cd /usr/local/mysql
$ sudo ./bin/mysqld_safe
(ENTER YOUR PASSWORD, IF NECESSARY)
(PRESS CONTROL-Z)
$ bg
(PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL)
To shutdown mysql (Don't do this yet!)
$ cd /usr/local/mysql
$ sudo mysqladmin shutdown
##
##
$ mysql -uroot -p
password:
..
..
...
mysql>
##
##
mysql> grant all privileges on test.* to '7stud'@'localhost' identified by 's3kr1t';
##
##
$ cpan DBD::mysql
##
##
$ perlbrew use perl-5.16.0
##
##
$ cpan -f -i DBD::mysql
##
##
$ perl -MCPAN -e shell
cpan> fforce install DBD::mysql
##
##
use strict;
use warnings;
use 5.012;
use DBI;
use DBD::mysql;
# CONFIG VARIABLES
my $db_type = "mysql";
my $database = "my_db";
my $host = "localhost";
my $port = "3306";
my $tablename = "people";
my $user = "root";
my $pw = "";
# DATA SOURCE NAME
my $dsn = "dbi:$db_type:$database:$host:$port";
# PERL DBI CONNECT
my $connect = DBI->connect($dsn, $user, $pw);
# PREPARE THE QUERY
my $query = "select * from $tablename";
my $query_handle = $connect->prepare($query);
$query_handle->execute();
my($id, $name, $info);
$query_handle->bind_columns(\$id, \$name, \$info);
while($query_handle->fetch()) {
say "$id, $name, $info";
}
##
##
mysql> CREATE DATABASE my_db CHARACTER SET utf8
mysql> show databases;
mysql> use my_db;
mysql> show tables;
mysql> CREATE TABLE people (id INT(12) not null auto_increment primary key, name VARCHAR(40), info VARCHAR(100));
mysql> describe people; #shows schema
mysql> INSERT INTO people(name, info) VALUES("Sally, "abc") ;
mysql> SELECT * FROM people;
#Only use the following if you want to delete data:
mysql> drop table people;
mysql> drop database my_db;