広告
広告
https://www.7key.jp/software/mysql_perl.html#a_01$ su-
https://www.7key.jp/software/mysql_perl.html#a_02# rpm -qa | grep MySQL
https://www.7key.jp/software/mysql_perl.html#a_03# groupadd mysql # adduser -g mysql -d /usr/local/mysql mysql
「MySQL Downloads」の「MySQL 4.0」をクリックし、画面一番下辺りの「Source downloads」から「Tarball (tar.gz)」をダウンロードする。
https://www.7key.jp/software/mysql_perl.html#a_04# cd /usr/local/src # tar zxvf mysql-4.0.20.tar.gz
https://www.7key.jp/software/mysql_perl.html#a_05# ./configure --with-charset=sjis \ --with-extra-charset=all \ --with-mysqld-user=mysql \ --with-innodb \ --prefix=/usr/local/mysql \ --with-unix-socket-path=/tmp/mysql.sock
https://www.7key.jp/software/mysql_perl.html#a_06# make # make install
https://www.7key.jp/software/mysql_perl.html#a_07# ./scripts/mysql_install_db --user=mysql
https://www.7key.jp/software/mysql_perl.html#a_08# chown -R mysql /usr/local/mysql # chgrp -R mysql /usr/local/mysql # chown -R mysql /var/lib/mysql
https://www.7key.jp/software/mysql_perl.html#a_09# /usr/local/mysql/bin/mysqld_safe &
https://www.7key.jp/software/mysql_perl.html#a_10# netstat -a | grep mysql
https://www.7key.jp/software/mysql_perl.html#a_11# ps -el | grep mysqld
https://www.7key.jp/software/mysql_perl.html#a_12# cd /usr/local/mysql/share/mysql # cp mysql.server mysql # chmod 755 mysql # mv mysql /etc/rc.d/init.d # cd /etc/rc.d/rc0.d/ # ln -s ..init.d/mysql K13mysql # cd ../rc3.d/ # ln -s ..init.d/mysql S90mysql # cd ../rc5.d/ # ln -s ..init.d/mysql S90mysql
https://www.7key.jp/software/mysql_perl.html#a_13# /usr/bin/mysql -u root mysql
https://www.7key.jp/software/mysql_perl.html#a_14mysql> set password for root=password('ここにパスワード');
mysql> exit
mysql> /usr/bin/mysql -u root mysql -p
PASSWORD : 入力
https://www.7key.jp/software/mysql_perl.html#a_15mysql> use mysql; mysql> delete from user where password=''; mysql> flush privileges; mysql> exit
https://www.7key.jp/software/mysql_perl.html#a_16mysql> grant all on enet.* to user@localhost identified by "user";
https://www.7key.jp/software/mysql_perl.html#a_17Perl 5.004 以上が必要であり、「Data-Dumper」→「DBI」→「Msql-Mysql-modules」の順でインストールする必要がある。それぞれのモジュールは「Download Perl/DBI modules」からダウンロードする。今回は「Data-Dumper-2.121.tar.gz」「DBI-1.43.tar.gz」「Msql-Mysql-modules-1.2219.tar.gz」をそれぞれ「/usr/local/src/」あたりに保存→展開する。
# cd /usr/local/src
# tar zxvf Data-Dumper-2.121.tar.gz
# tar zxvf DBI-1.43.tar.gz
# tar zxvf Msql-Mysql-modules-1.2219.tar.gz
# cd Data-Dumper-2.121
# perl Makefile.PL
# make
# make test
# make install
# cd ../DBI-1.43
# perl Makefile.PL
# make
# make test
# make install
# cd ../DBD-mysql-2.9004
# perl Makefile.PL
Which drivers do you want to install?
1) MySQL only
2) mSQL only (either of mSQL 1 or mSQL 2)
3) MySQL and mSQL (either of mSQL 1 or mSQL 2)
4) mSQL 1 and mSQL 2
5) MySQL, mSQL 1 and mSQL 2
Enter the appropriate number: [3] 1
Do you want to install the MysqlPerl emulation? You might keep your old
Mysql module (to be distinguished from DBD::mysql!) if you are concerned
about compatibility to existing applications! [n]
Where is your MySQL installed? Please tell me the directory that
contains the subdir 'include'. [/usr/local/mysql]
Which database should I use for testing the MySQL drivers? [test]
On which host is database test running (hostname, ip address
or host:port) [localhost]
User name for connecting to database test? [undef]
Password for connecting to database test? [undef]
# make
# make test
# make install
https://www.7key.jp/software/mysql_perl.html#a_18適当なデータベース、テーブルを作成し、次のような「test.pl」から接続テストを行う
use DBI;
$ds = 'DBI:mysql:testdb:localhost';
$user = 'user';
$pass = 'user';
$dbh = DBI->connect($ds, $user, $pass,{RaiseError=>0,PrintError=>1,AutoCommit=>1})
|| die "Got error $DBI::errstr when connecting to $ds\n";
$dbh->disconnect;
1;
広告