mysql mysql mysql> select user,host,password from user; +------+-----------+----------+ | user | host | password | +------+-----------+----------+ | root | locahost | | | root | hostname | | | root | 127.0.0.1 | | | | locahost | | | | hostname | | +------+-----------+----------+ と、初期状態ではパスワード無し、ユーザー無しなので 空欄ユーザーは削除、rootにはパスワードを設定する。 DELETE FROM user where user=''; DELETE FROM user where user='root' and host='hostname'; GRANT ALL on *.* to root@"%" identified by 'hogehoge' with grant option; SET PASSWORD FOR root@127.0.0.1 = PASSWORD('hogehoge'); FLUSH PRIVILEGES; など。 mysql_secure_installation でもいいけど、何をしているか理解するためなんだからねっ///
少し整理。相変わらず暫定、書いてないオプションはデフォってことで。
# MySQLサーバーセクション [mysqld] ## General Options # TCPを利用しない(ソケットのみの)場合 # skip-networking port = 3306 # 1つのアドレスのみバインド可能。複数指定時は最後のものを使用 bind-address = xxx.xxx.xxx.xxx socket = /xxx/mysql.sock datadir = /var/xxxx # 4byteUTF-8対応。サイズとか角度とか色々注意。 character_set_server = utf8mb4 # クエリログを利用する場合 # general_log = 1 # general_log_file = /usr/local/var/mydata/query_log
##SSL Options # ssl # ssl-ca =/xxx/xxx # ssl-capath =/xxx # ssl-cert =/xxx/xxx # ssl-cipher =xxx:xxx:xxx # ssl-key =/xxx/xxx # ssl-verify-server-cert =/xxx/xxx
##Connections and Related Options max_connections = 300 # max_connections x JOINする最大テーブル数を目安 # Opened_tablesを見ながら調整(400..524288) table_open_cache = 2048 # table_open_cache x 2 + max_connections + 10が最低値(0..65535) open_files_limit = 8192 # スレッド使い回し数 # Threads_createdとConnectionsを見ながら調整 thread_cache_size = 100 # アイドル接続のタイムアウト時間 # 規定値が28800秒(8h)なので適宜変更する # (忙しいサーバは短めにしてスレッドキャッシュを増やすなど) # どちらの値を使うかはクライアント次第 interactive_timeout = 3600 wait_timeout = 3600
##Memory Options # おっきくしとこな? key_buffer_size = 1G # インメモリテーブルが作成されやすいなら増やす max_heap_table_size = 16M tmp_table_size = 16M # ネットワークバッファ(規定値) #net_buffer_length = 16K #max_allowed_packet = 1M # ソート関係のバッファ # Sort_merge_passesを見ながら調整 sort_buffer_size = 4M read_buffer_size = 256K read_rnd_buffer_size = 512K ##InnoDB Options ## メモリ # おっきくしとこな? innodb_buffer_pool_size = 1G # 内部データプールサイズ innodb_additional_mem_pool_size = 20M ## InnoDBログ(a.k.a. REDOログ→ib_logfileN) # InnoDBログの数(規定値) #innodb-log-files-in-group = 2 # InnoDBログの書き込みとフラッシュ挙動(規定値) # 1はcommitごとに書き込んでフラッシュ #innodb_flush_log_at_trx_commit = 1 # フラッシュ方法 # できる限りオンメモリにする(OSキャッシュを使えないようにする)と # O_DIRECTの恩恵が得られる innodb_flush_method = O_DIRECT # バッファ(規定値) # 通常フラッシュ頻度の方が高いのであまり持たなくていい #innodb_log_buffer_size = 8M # InnoDBログファイルサイズ innodb_log_file_size = 128M ## データファイル # データファイルサイズと拡張挙動 innodb_data_file_path = ibdata0:10M:autoextend:max:50G # InnoDBのファイルフォーマット # 現在、Antelope、Barracudaの2種のみ # 規定値は後方互換重視でAntelopeの様子 # 圧縮機能など利用する場合はBarracudaが必要 innodb_file_format = Barracuda innodb_file_format_max = Barracuda # テーブルごとにデータファイルを生成するかどうか # 圧縮機能を利用する場合は必要 innodb_file_per_table = 1
## MyISAM Options(Provisional myisam_use_mmap = 1 myisam_mmap_size = 1G myisam_sort_buffer_size = 8M
##Query Cache # クエリキャッシュサイズ query_cache_size = 16M # クエリキャッシュ方法 query_cache_type = 1 # キャッシュするクエリ結果のサイズ制限 query_cache_limit = 4M
## Misc. #skip-external-locking
## Replication Master Server (default) server-id = 1
## Binary Log Options log_bin = mysql-bin # うーん・・・WriteCacheがあるRAIDカード搭載なら1でも・・・ #sync_binlog = 0 binlog_format = mixed expire_logs_days = 7
[mysqldump] skip-opt create-options default-character-set=binary hex-blob max_allowed_packet = 16M master-data quick set-charset single-transaction # [mysql] ## -pつけるの面倒だし。 password no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [client] # password = port = 3306 socket = /xxx/mysql.sock [myisamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout