flagflag  If you want to see English page, please click "English" Button at Left.
  • ソース を表示
  • MySQL/UTF-8 は削除されています。
1: 2009-04-20 (月) 23:27:02 iseki ソース 現: 1970-01-01 (木) 18:00:00 ソース
Line 1: Line 1:
-*** mySQL 操作メモ(一般) [#wdf44d77] 
-**** 他のホストへ接続 [#pa3d23f4] 
- mysql -u netp_user -h 202.26.158.3 -p 
-**** テーブル参照権限を与える [#h23eb7b7] 
- grant references on netp_exam.* to netp_user identified by 'netp_pass'; 
- 
-**** select 権限を与える [#a11325f6] 
- grant select on netp_exam.* to netp_user identified by 'netp_pass'; 
- 
-- データベース一覧 
- show databases; 
- 
-- テーブル一覧 
- use データベース名; 
- show tables; 
- 
-- テーブル削除 
- use データベース名; 
- drop table テーブル名; 
- 
-- 項目削除 
- delete  from テーブル名 where 条件; 
- 例: delete  from mdl_log_display where module="quiz"; 
- 
-** データベースのチェックとリペア [#qa10bf63] 
-- データベースを止めてから,チェックを行う 
- # /etc/init.d/mysql stop 
- # /usr/local/mysql/bin/myisamchk /var/mysql/[DBNAME]/*.MYI 
- # /etc/init.d/mysql start 
- 
-** データベースの移行 MySQL4 -> MySQL5 [#m873e409] 
-+ MySQL5 を MySQL4と被らないようにインストールする. 
-+ MySQL5 のデータベースを作成する(初期化する). 
-  # /usr/local/mysql5/bin/mysql_install_db --user=mysql --ldata=/var/mysql5 
-  # cp support-files/my-medium.cnf /var/mysql5/my.cnf 
-  # chown mysql /var/mysql5/my.cnf 
-  # /etc/init.d/mysql5 を作る 
-+ MySQL4 の移行するデータベース(xoops)をダンプする. 
-  # /usr/local/mysql/bin/mysqldump -x xoops -u root -p > xoops.dump 
-+ MySQL4 を止めて,MySQL5 を起動する. 
- # /etc/init.d/mysql  stop 
- # /etc/init.d/mysql5 start 
- # /usr/local/mysql5/bin/mysqladmin -u root password パスワード 
-+ MySQL5 で受け入れ側となる個別のデータベースを作成し,権限を旧データベースと同様に設定する. 
- mysql> create database xoops; 
- mysql> grant all on xoops.* to xoops_user identified by 'xoops_pass'; 
-+ データをリストアする. 
- mysql> source xoops.dump        xoops.dump は mysqlが読める必要がある. 
-+ または 
- # /usr/local/mysql5/bin/mysql xoops -u root -p < xoops.dump 
- 
-*** データベースの移行 [#sadd4d69] 
-- 移行元のデータベースの CHARSETが latin1 で EUCで保存 
-- 移行先は utf8 
- % mysqldump source_db source_table --default-character-set=latin1 -x -u root -p > table_data 
- % nkf -w table_data > table_data.utf8 
-table_data.utf8内のテーブル名,CHARSETを新しいデータベースに合わせる. 
- % mysql dist_db -u root -p < table_data.utf8 
- 
-** UTF-8 で使用する場合 [#u5d358e3] 
- mysql> show variables like "char%"; 
- +--------------------------+-----------​------------------------------------+ 
- | Variable_name            | Value                                        | 
- +--------------------------+-----------​------------------------------------+ 
- | character_set_client    | latin1                                        | 
- | character_set_connection | latin1                                        | 
- | character_set_database  | latin1                                        | 
- | character_set_filesystem | binary                                        | 
- | character_set_results    | latin1                                        | 
- | character_set_server    | latin1                                        | 
- | character_set_system    | utf8                                          | 
- | character_sets_dir      | /usr/local/mysql-5.0.67/share/mysql/char​sets/ | 
- +--------------------------+-----------​------------------------------------+ 
-この場合は latin1 を utf8にする 
- mysql> set character_set_client=utf8; 
- mysql> set character_set_connection=utf8; 
- mysql> set character_set_database=utf8; 
- mysql> set character_set_results=utf8; 
- mysql> set character_set_server=utf8; 
- mysql> show variables like "char%"; 
- +--------------------------+-----------​------------------------------------+ 
- | Variable_name            | Value                                        | 
- +--------------------------+-----------​------------------------------------+ 
- | character_set_client    | utf8                                          | 
- | character_set_connection | utf8                                          | 
- | character_set_database  | utf8                                          | 
- | character_set_filesystem | binary                                        | 
- | character_set_results    | utf8                                          | 
- | character_set_server    | utf8                                          | 
- | character_set_system    | utf8                                          | 
- | character_sets_dir      | /usr/local/mysql-5.0.67/share/mysql/char​sets/ | 
- +--------------------------+-----------​------------------------------------+ 


トップ   新規 ページ一覧 単語検索 最終更新   ヘルプ   最終更新のRSS 1.0 最終更新のRSS 2.0 最終更新のRSS Atom

サイト内 検索

ログイン

ユーザー名:

パスワード:


パスワード紛失
新規登録

サブ メニュー

ミニカレンダー

前月2025年 5月翌月
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
<今日>

オンライン状況

67 人のユーザが現在オンラインです。 (5 人のユーザが xpwiki を参照しています。)

登録ユーザ: 0
ゲスト: 67

もっと...

アクセスカウンタ

今日 : 8259825982598259
昨日 : 1641116411164111641116411
総計 : 2614847126148471261484712614847126148471261484712614847126148471
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com