Google
 

« FreeBSD&Linux | メイン | PHP&Perl »

2008年12月15日

●pdo_mysql

PDOライブラリを PHPでロードさせようとすると、

PHP Warning: Module 'PDO' already loaded in Unknown on line 0
/libexec/ld-elf.so.1: /usr/local/lib/php/extensions/pdo_mysql.so: Undefined symbol "php_pdo_declare_long_constant"

disable-pdoで、configureし直す。。

vi php.ini
include_path = ".:/php/includes:/usr/local/lib/php"
extension_dir = "/usr/local/lib/php/extensions"


extension=pdo.so
extension=pdo_mysql.so


2007年12月05日

●phpMyAdminアップロードサイズ変更

phpMyAdmin
アップロードサイズ変更

デフォルトは2048KBです。

この最大サイズを変更するには、php.ini を編集

memory_limit
post_max_size
upload_max_filesize

memory_limit > post_max_size > upload_max_filesize

2007年11月23日

●InnoDB テーブルのデフラグメント

InnoDB テーブルのデフラグメント

[mysqld]
innodb_file_per_table

mysql> ALTER TABLE FileInfo TYPE=InnoDB;
Query OK, 0 rows affected, 1 warning (5.65 sec)
Records: 0 Duplicates: 0 Warnings: 0

2007年05月07日

●MySQLデータファイルのメンテナンス

mysqlのデータの確認
myisamchk /データまでのパス/*.MYI

データの修復
myisamchk -r /データまでのパス/*.MYI

データの最適化
myisamchk -d /データまでのパス/*.MYI

2007年04月27日

●phpMyAdminの設置(phpmyadmin 2.9.1.1)

​phpmyadmin 2.9.1.1の設定


http://www.xxx.xx.jp/phpmyadmin​バージョン/scripts/setup.php

config/config.inc.phpが作成される

cp config.inc.php phpmyadmin​バージョン/

2007年04月07日

●MySQLの文字化け

MySQLの文字化け対策

クライアント、サーバ間で違う文字コードがセットされていると、文字化けが起こる可能性がある。

続きを読む "MySQLの文字化け"
2007年04月06日

●mysql関数からmysqli関数

mysqli関数に対応していないPHPスクリプトをとりあえず対応させる

続きを読む "mysql関数からmysqli関数"
2007年03月20日

●mysqldumpでバックアップ&復元

mysqldumpのバックアップ
これですべてのデータベースのバックアップ

$ mysqldump -u root -x --all-databases > dump.sql

個別データベースのバックアップ

$ mysqldump -u root データベース名 > dump.sql

すべてのデータベースの復元

$ mysql -u root -p < dump.sql


個別データベースのバックアップの復元

$ mysql -u root データベース名 < dump.sql

2007年02月17日

●MySQLインストール

useradd -M -o -r -d /var/lib/mysql -s /sbin/nologin -c "MySQL" -u 27 mysql

cd /usr/src
wget http://mysql.he.net/Downloads/mysql-4.0.24.tar.gz

tar -zxf mysql-4.0.24.tar.gz

cd /usr/src/mysql-4.0.24

続きを読む "MySQLインストール"
2007年01月12日

●functions to transition Mysql SQL to PostgreSQL

drop function ifnull (text, text);
create function ifnull (text, text) returns text AS '
select coalesce($1, $2) as result
' language 'sql';


drop function ifnull (int4, int4);
create function ifnull (int4, int4) returns int4 as '
select coalesce($1, $2) as result
' language 'sql';


drop function from_unixtime(integer);
create function from_unixtime(integer) returns timestamp as '
select abstime($1) as result
' language 'sql';


drop function unix_timestamp(timestamp);
create function unix_timestamp(timestamp) returns integer as '
select date_part(''epoch'', $1)::int4 as result
' language 'sql';


drop function to_days(timestamp);
create function to_days(timestamp) returns integer as '
select date_part(''day'', $1 - ''0000-01-01'')::int4 as result
' language 'sql';


drop function from_days(integer);
create function from_days(integer) returns timestamp as '
select ''0000-01-02''::timestamp + ($1 || '' days'')::interval as result
' language 'SQL';


drop function convert_date_format(text);
create function convert_date_format(text)
returns text
as '
set old_format $1
array set substitutions {%% %
%M Month
%W Day
%D FMDDth
%Y YYYY
%y YY
%X ""
%x ""
%a Dy
%d DD
%e FMDD
%m MM
%c FMmm
%b Mon
%j DDD
%H HH24
%k FMHH24
%h HH12
%I HH12
%l FMHH12
%i MI
%r {HH12:MI:SS AM}
%T HH24:MI:SS
%S SS
%s SS
%p AM}

set string_size [string length $old_format]
set i 0
set new_format ""

while { $i < $string_size } {
set fchar [string index $old_format $i]
if { $fchar == "%" } {
set code [string range $old_format $i [expr $i + 1]]
if [info exists substitutions($code)] {
append new_format $substitutions($code)
incr i
} else {
append new_format $fchar
}
} else {
append new_format $fchar
}

incr i
}
return $new_format
' language 'pltcl';


drop function date_format(timestamp, text);
create function date_format(timestamp, text)
returns text
as '
select to_char($1, convert_date_format($2))
' language 'sql';