mysql で文字化け

[root@mysql /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 424 to server version: 4.1.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> status;

                          • -

mysql Ver 14.7 Distrib 4.1.22, for redhat-linux-gnu (i686) using readline 4.3

Connection id: 424
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 4.1.22
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 28 days 6 hours 7 min 11 sec

Threads: 1 Questions: 2552 Slow queries: 0 Opens: 126 Flush tables: 1 Open tables: 41 Queries per second avg: 0.001

                          • -

mysql> exit
Bye
[root@mysql /]#

[root@mysql /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 431 to server version: 4.1.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SHOW VARIABLES LIKE 'character\_set\_%';

                                                                        • +
Variable_name Value
                                                                        • +
character_set_client latin1
character_set_connection latin1
character_set_database latin1
character_set_results latin1
character_set_server latin1
character_set_system utf8
                                                                        • +

6 rows in set (0.00 sec)

mysql>

http://blog.srengine.com/2008/03/mysql-utf-8.html
http://i-am.web777.net/2007/03/mysql_utf8.html
http://it.kndb.jp/entry/show/id/15

/etc/my.cnf
を変える


ちなみに、MODx の文字化けは解消せず。
バックアップ、文字エンコード変更、リストア→したけどNG
MODx再インストールしたら文字化け解消した。
このあとリストアしたらいけるかもね。

[root@penguin ~]# vzyum 107 --enablerepo=centosplus list
exec /usr/share/vzyum/bin/yum -c /vz/template/centos/4/i386/config/yum.conf --installroot /vz/root/107 --vps=107 --enablerepo=centosplus list


Error getting repository data for centosplus, repository not found
[root@penguin ~]#

centosplus がないって怒られる

/vz/template/centos/4/i386/config/yum.conf を見ると確かにない。
なので、
/etc/yum.repos.d/CentOS-Base.repo
を参考に追記しておく

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=2
protect=1


[root@penguin config]# vzyum 107 --enablerepo=centosplus list
exec /usr/share/vzyum/bin/yum -c /vz/template/centos/4/i386/config/yum.conf --installroot /vz/root/107 --vps=107 --enablerepo=centosplus list
not using ftp, http[s], or file for repos, skipping - Null is not a valid release or hasnt been released yet


Cannot find a valid baseurl for repo: centosplus
[root@penguin config]#

not found から cannot find a valid baseurl に変わった。
よしよし。

baseurl を設定しよう

baseurl=http://mirror.centos.org/centos/4/centosplus/i386/

qmail で makeエラー

http://d.hatena.ne.jp/sukesam/20030916

qmail のセットアップ時にエラー

[root@www netqmail-1.06]# make setup check
( cat warn-auto.sh; \
echo CC=\'`head -1 conf-cc`\'; \
echo LD=\'`head -1 conf-ld`\' \
) > auto-ccld.sh
cat auto-ccld.sh make-load.sh > make-load
chmod 755 make-load
(中略)
./load qmail-remote control.o constmap.o timeoutread.o \
timeoutwrite.o timeoutconn.o tcpto.o now.o dns.o ip.o \
tls.o ssl_timeoutio.o -L/usr/local/ssl/lib -lssl -lcrypto \
ipalloc.o strsalloc.o ipme.o quote.o ndelay.a case.a sig.a open.a \
lock.a seek.a getln.a stralloc.a alloc.a substdio.a error.a \
str.a fs.a auto_qmail.o `cat dns.lib` `cat socket.lib`
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x51): In function `dlfcn_load':
: undefined reference to `dlopen'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0xc2): In function `dlfcn_load':
: undefined reference to `dlclose'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0xf1): In function `dlfcn_load':
: undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x179): In function `dlfcn_unload':
: undefined reference to `dlclose'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x239): In function `dlfcn_bind_var':
: undefined reference to `dlsym'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x289): In function `dlfcn_bind_var':
: undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x331): In function `dlfcn_bind_func':
: undefined reference to `dlsym'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x381): In function `dlfcn_bind_func':
: undefined reference to `dlerror'
collect2: ld returned 1 exit status
make: *** [qmail-remote] Error 1
[root@www netqmail-1.06]# pwd
/opt/local/src/qmail/netqmail-1.06

/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x51): In function `dlfcn_load':
: undefined reference to `dlopen'
は、dlfcn_load にて、dlopen が定義されていないということ、
つまり、dlopen が定義されている、DSO(ダイナミック共有オブジェクト)へのリンクがない。
なので、Makefileコンパイルオプションに -ldl をつけてやるとDSOを呼べるようになる。

編集前:
1571 qmail-remote: \
1572 load qmail-remote.o control.o constmap.o timeoutread.o timeoutwrite.o \
1573 timeoutconn.o tcpto.o now.o dns.o ip.o ipalloc.o strsalloc.o ipme.o quote.o \
1574 ndelay.a case.a sig.a open.a lock.a seek.a getln.a stralloc.a alloc.a \
1575 substdio.a error.a str.a fs.a auto_qmail.o dns.lib socket.lib
1576 ./load qmail-remote control.o constmap.o timeoutread.o \
1577 timeoutwrite.o timeoutconn.o tcpto.o now.o dns.o ip.o \
1578 tls.o ssl_timeoutio.o -L/usr/local/ssl/lib -lssl -lcrypto\
1579 ipalloc.o strsalloc.o ipme.o quote.o ndelay.a case.a sig.a open.a \
1580 lock.a seek.a getln.a stralloc.a alloc.a substdio.a error.a \
1581 str.a fs.a auto_qmail.o `cat dns.lib` `cat socket.lib`
編集後:
1571 qmail-remote: \
1572 load qmail-remote.o control.o constmap.o timeoutread.o timeoutwrite.o \
1573 timeoutconn.o tcpto.o now.o dns.o ip.o ipalloc.o strsalloc.o ipme.o quote.o \
1574 ndelay.a case.a sig.a open.a lock.a seek.a getln.a stralloc.a alloc.a \
1575 substdio.a error.a str.a fs.a auto_qmail.o dns.lib socket.lib
1576 ./load qmail-remote control.o constmap.o timeoutread.o \
1577 timeoutwrite.o timeoutconn.o tcpto.o now.o dns.o ip.o \
1578 tls.o ssl_timeoutio.o -L/usr/local/ssl/lib -lssl -lcrypto -ldl\
1579 ipalloc.o strsalloc.o ipme.o quote.o ndelay.a case.a sig.a open.a \
1580 lock.a seek.a getln.a stralloc.a alloc.a substdio.a error.a \
1581 str.a fs.a auto_qmail.o `cat dns.lib` `cat socket.lib`

他にもあるが同様に追加する

OpenVZインストールはまりどころ

apacheのソースインストールで、/var/www のパーミッション
drwx------ 4 apache apache 4096 Apr 25 19:50 www
だと、その下のディレクトリへのパーミッションがないので、
chmod 777 www してやる

openssl 付でapache をインストールするには、先にopenssl をmake install してあげる必要がある。
http://d.hatena.ne.jp/rougeref/20080616

>pwd
/opt/local/src/apache/httpd-2.2.11 
>ls ../
httpd-2.2.11 openssl-0.9.8h openssl-0.9.8k
httpd-2.2.11.tar.gz openssl-0.9.8h.tar.gz openssl-0.9.8k.tar.gz
httpd-2.2.11.tar.gz.md5 openssl-0.9.8h.tar.gz.md5 openssl-0.9.8k.tar.gz.md5
>./configure --prefix=/usr/local/apache --enable-layout=RedHat --enable-rewrite --enable-so --enable-headers --enable-setenvif --enable-proxy --enable-proxy-balancer --enable-ssl --with-ssl=../openssl-0.9.8k --disable-userdir
>make
これだとダメで、

>./configure --prefix=/usr/local/apache --enable-layout=RedHat --enable-rewrite --enable-so --enable-headers --enable-setenvif --enable-proxy --enable-proxy-balancer --enable-ssl --with-ssl=/usr/local/ssl --disable-userdir
>make

これだとうまくいった。

ORマッパークラス(スキーマ)を作成する
・・・lib/MyApp/Schema 配下のpmを削除して、スキーマ再作成

perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib -e 'make_schema_at "MyApp::Schema", {relationships => 1, debug => 1}, ["dbi:Pg:dbname=sandbox_nishino1;host=st-db.shanon.co.jp;port=5432","nishino",]'


SQLの追加

[nishino@nishino-dev sql]$ cat create_table.sql
DROP TABLE dump_history;
DROP SEQUENCE dump_history_id_seq;

CREATE TABLE dump_history(
id integer NOT NULL PRIMARY KEY,
"disable" integer DEFAULT 0 NOT NULL,
memo text
);

    • ALTER TABLE ONLY dump_history
    • ADD CONSTRAINT dump_history_pkey PRIMARY KEY (id);

CREATE SEQUENCE dump_history_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER TABLE dump_history ALTER COLUMN id SET DEFAULT nextval('dump_history_id_seq'::regclass);

INSERT INTO dump_history ("disable", memo) VALUES(0,'aaa');
INSERT INTO dump_history ("disable", memo) VALUES(0,'bbb');
INSERT INTO dump_history ("disable", memo) VALUES(0,'ccc');
INSERT INTO dump_history ("disable", memo) VALUES(0,'ddd');

[nishino@nishino-dev HelloWorld]$ ./script/helloworld_create.pl model DBIC::Schema DBIC::Schema "dbi:Pg:dbname:sandbox_nishino1;host=st-db.shanon.co.jp;port=5432;" nishino
created "/home/nishino/works/pg/HelloWorld/script/../lib/HelloWorld/Model/DBIC"
exists "/home/nishino/works/pg/HelloWorld/script/../t"
created "/home/nishino/works/pg/HelloWorld/script/../lib/HelloWorld/Model/DBIC/Schema.pm"
created "/home/nishino/works/pg/HelloWorld/script/../t/model_DBIC-Schema.t"