2011年9月19日月曜日

[MySQL] 外部からアクセス

ポート開放の確認
$ telnet xx.xx.xx.xx 3306

ユーザーの確認
mysql> use mysql
mysql> select user, host from user;

外部IPアドレスの追加
mysql> grant all privileges on xxxdb.* to hoge@"192.168.1.%"

hoge@"%" すべてのホストからアクセス可能
hoge@localhost localhostからアクセス可能
hoge@"192.168.1.2" 192.168.1.2からアクセス可能
hoge@"192.168.%.%" %はワイルドカード

アクセス
$ mysql -h xx.xx.xx.xx -u hoge -p

2011年5月18日水曜日

[Linux] パス(/usr/local/lib)を追加

/etc/ld.so.conf に /usr/local/lib を追加

# /sbin/ldconfig

[Linux] apacheを自動起動

# chkconfig httpd on

確認するには
# chkconfig --list

2011年2月26日土曜日

[Django] Model/select_related()

自動的に外部キーのリレーションを追跡し、クエリの実行時にリレーション先のオブジェクトも加えて選択するようなQuerySetを返す

e = Entry.objects.select_related().get(id=5)

2011年2月16日水曜日

[Apache] Digest認証

# htdigest -c /etc/httpd/.htdigest 'Secret Zone' secret

<directory "/hoge/poge">
AuthType Digest
AuthName "My Server"
AuthDigestDomain /poge/
AuthUserFile /etc/httpd/.htdigest
Require user secret
</Directory>

[JavaScript] const

const はIEでは使えない。

2010年11月25日木曜日

[Linux] 行数をカウントする

$ wc hoge.txt

3 38 286
行数 単語数 ファイルサイズ