-
Notifications
You must be signed in to change notification settings - Fork 581
Mysql
yuki-kimoto edited this page Mar 13, 2012
·
4 revisions
MySQL is one of RDBMS(Relational Database Management System). In this, installation proccess is explained easily.
CentOS:
yum -y install mysql-server
yum -y install mysql
yum -y install mysql-libs
yum -y install mysql-devel
(maybe mysql-libs is not needed toady)
Start MySQL database server.
service mysqld start
Connect to MySQL server
mysql
Create database named "app1".
create database app1;
Add database user named "app1".
GRANT ALL ON app1.* TO 'app1'@'localhost' IDENTIFIED BY 'FUETYR%@';
DBI is database interface module to access database from perl.
cpanm DBI
See Building application local environment about cpanm .
DBD::mysql is database driver to access MySQL server.
cpanm DBD::mysql
Connect to MySQL server "app1" database from perl.
use DBI;
my $database = 'app1';
my $user = 'app1';
my $password = 'FUETYR%@';
my $dbh = DBI->connect("DBI:mysql:$database", $user, $password);
If you want to see table database information(table definition, table rows, or etc) on browser, use Mojolicious::Plugin::MySQLViewerLite
# Mojolicious::Lite
plugin 'MySQLViewerLite', dbh => $dbh;
# Mojolicious
$app->plugin('MySQLViewerLite', dbh => $dbh);
# Access
http://localhost:3000/mysqlviewerlite