忍者ブログ

インフラエンジニアのVPS徹底比較

VPSを徹底的に比較するサイトです。 VPSは、FX自動売買環境、WEBシステム、開発環境など最適です。
VPSの
機能比較
用途/目的別
のVPS比較
BCP/DR対策
のVPS比較
VPSの
価格比較
FX用VPS
比較
おすすめ
VPS業者
VPSの
注意点


HOME   »     »  MySQLの簡単構築 Webサーバ構築手順  »  MySQLの簡単構築

[PR]

広告   

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

VPS(レンタルサーバー)をサービス・機能で比較

VPS(レンタルサーバー)をサービス・機能で比較 (GMOクラウドVPS,さくらVPS,WebARENA SuitePRO,CloudCore VPS)
VPS(レンタルサーバー)をサービス・機能で比較 (ServersMan@VPS,Conoha,使えるねっとVPS,VitualWeb)
VPS(レンタルサーバー)をサービス・機能で比較 (@YMC,Speever,SEEDS,SPPD)
VPS(レンタルサーバー)をサービス・機能で比較 (ラピッドサイト,お名前.com,ServerQueen,ABLENET)


VPS(レンタルサーバー)を用途/目的で比較

ASP.NETが利用可能なWindowsVPSの比較 (VitualWeb,使えるねっとVPS,GMOクラウド VPS,ABLENET)
FX自動売買環境としてのWindowsVPS(リモートデスクトップ)比較 (お名前.comVPS,使えるねっとVPS,ServersMan@VPS,SPPD)
地域別(電力会社管内別)のVPS 【BCP/DR対策】
東京電力会社管内のVPS (さくらVPS, ServersMan@VPS, VirtualWeb, SEEDS, Conoha)
関西電力会社管内のVPS (さくらVPS, ServersMan@VPS, ABLENET)


VPS(レンタルサーバー)を契約の前に

VPS(レンタルサーバー)で注意すべきこと
VPS(レンタルサーバー)を契約の前に確認すべきこと



web拍手 by FC2 Google+

MySQLの簡単構築

広告   

MySQLの簡単構築

運用とセキュリティを考慮したMySQLサーバを構築手順を説明します。

MySQL関連ディレクトリの作成

デフォルトのディレクトリから下記のように変更する。
Dataディレクトリ /data/db/mysql/opesrc_data
Mysqlログディレクトリ /data/db/mysql/log

MySQL関連ディレクトリの作成
# mkdir -p /data/db/mysql/opesrc_data
# mkdir -p /data/db/mysql/log

ディレクトリをMySQLの実行ユーザへ変更する

# chown -R mysql /data/db/mysql

ログディレクトリのリンク作成
運用上を考慮し、/var/log/にログディレクトリのリンクを張っておく。
# ln -s /data/db/mysql/log /var/log/mysqld 

起動スクリプトの修正

DBデータ指定
RPMでインストールした起動スクリプトで、DATAディレクトリを指定されています。そのためmy.cnfで定義した内容は無視 されるので、DATAディレクトリやログファイルを変更したい場合は注意が必要です。
# vi /etc/init.d/mysqld
get_mysql_option mysqld datadir "/data/db/mysql/opesrc_data"
datadir="$result"
get_mysql_option mysqld socket "$datadir/mysql.sock"
socketfile="$result"
get_mysql_option mysqld_safe log-error "/data/db/mysql/log/mysqld.log"
errlogfile="$result"
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
mypidfile="$result"
 }

Mysqlログローテート設定

vi /etc/logrotate.d/mysqld
/data/db/mysql/log/mysqld.log /data/db/mysql/log/slow_query.log  {
        # create 600 mysql mysql
        notifempty
        weekly
        rotate 60
        missingok
        compress
    postrotate
        # just if mysqld is really running
        if test -x /usr/bin/mysqladmin && \
           /usr/bin/mysqladmin ping &>/dev/null
        then
           /usr/bin/mysqladmin flush-logs
        fi
    endscript
 }

my.cnfの編集

my.cnfファイルをバックアップし、下記の内容に書き換える。
デフォルトよりパフォーマンスを考慮した設定にしています。環境に合わせて、チューニングをしてください。
# vi /etc/my.cnf
[mysql]
default-character-set=utf8

[mysqld]
#skip-grant-tables
##---- 基本設定 ------------------------
port            = 3306
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
back_log = 50

##---- 制限 ------------------------
max_connections = 200
max_connect_errors = 1000
wait_timeout = 28800

##---- チューニング ------------------------
table_open_cache = 4096
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 4M
join_buffer_size = 4M
thread_cache_size = 16
thread_concurrency = 8
#query_cache_type = ON
query_cache_min_res_unit = 4K
query_cache_size = 64M
query_cache_limit = 2M
tmp_table_size = 64M
thread_stack = 192K
#skip-bdb
skip-name-resolve


##---- ストレージエンジン ------------------------
default-storage-engine = INNODB
#default-table-type = INNODB
innodb_additional_mem_pool_size = 16M
innodb_data_file_path = ibdata1:30M:autoextend
#innodb_write_io_threads = 8
#innodb_read_io_threads = 8
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_buffer_pool_size = 2G
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120

# LOG関連
log-bin=mysql-bin
binlog_format=mixed
expire-logs-days=7
slow_query_log = ON
slow_query_log_file = /data/db/mysql/log/slow_query.log
long_query_time = 2
log_queries_not_using_indexes

server-id = 1
ft_min_word_len = 4
transaction_isolation = REPEATABLE-READ

#Function対応(Function作成時のみ)
#log_bin_trust_function_creators=1

#Myisam関連
key_buffer_size = 32M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

[mysqld_safe]

Mysql起動と自動起動設定

# /etc/init.d/mysqld start
# chkconfig mysqld on
※Mysqlが起動しない場合は、[/var/log/mysql/mysql.log]の内容を確認する。

MySQLのセキュリティ設定

MySQLの初期セキュリティ設定を行うために、mysql_secure_installationコマンドが用意されている。
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Mysqlアカウントの作成

# myql -u root -p
mysql> create database alminium DEFAULT CHARACTER SET utf8;
mysql> GRANT RELOAD ON *.* TO 'alminium'@'%' ;
mysql> GRANT ALL ON `alminium`.* TO 'alminium'@'%'   ;
mysql> set password for 'alminium'@'%'=PASSWORD('password9L')

MySQLのエラー

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

というエラーが出た場合、Mysqlのデータディレクトリにあるすべてをを削除する。
 # /etc/init.d/mysqld stop
 # rm -rf /data/db/mysql/opesrc_data/*
 # /etc/init.d/mysqld start 


[サンプルで覚えるMYSQL―データベース接続の基本から応用まで]の書籍横断比較とレビュー

サンプルで覚えるMYSQL―データベース接続の基本から応用まで
著者:五十嵐 貴之
出版日:2011-04
出版社:ソシム

[MySQLトラブルシューティング]の書籍横断比較とレビュー

MySQLトラブルシューティング
著者:Sveta Smirnova
出版日:2012-10-13
出版社:オライリージャパン



VPS(レンタルサーバー)をサービス・機能で比較

VPS(レンタルサーバー)をサービス・機能で比較 (GMOクラウドVPS,さくらVPS,WebARENA SuitePRO,CloudCore VPS)
VPS(レンタルサーバー)をサービス・機能で比較 (ServersMan@VPS,Conoha,使えるねっとVPS,VitualWeb)
VPS(レンタルサーバー)をサービス・機能で比較 (@YMC,Speever,SEEDS,SPPD)
VPS(レンタルサーバー)をサービス・機能で比較 (ラピッドサイト,お名前.com,ServerQueen,ABLENET)


VPS(レンタルサーバー)を用途/目的で比較

ASP.NETが利用可能なWindowsVPSの比較 (VitualWeb,使えるねっとVPS,GMOクラウド VPS,ABLENET)
FX自動売買環境としてのWindowsVPS(リモートデスクトップ)比較 (お名前.comVPS,使えるねっとVPS,ServersMan@VPS,SPPD)
地域別(電力会社管内別)のVPS 【BCP/DR対策】
東京電力会社管内のVPS (さくらVPS, ServersMan@VPS, VirtualWeb, SEEDS, Conoha)
関西電力会社管内のVPS (さくらVPS, ServersMan@VPS, ABLENET)


VPS(レンタルサーバー)を契約の前に

VPS(レンタルサーバー)で注意すべきこと
VPS(レンタルサーバー)を契約の前に確認すべきこと



web拍手 by FC2 Google+
Yahoo!ブックマーク Googleブックマーク はてなブックマーク livedoorClip del.icio.us FC2 ニフティクリップ iza Buzzurl 




PR

最新記事
(07/18)
(10/12)
(09/27)
(09/20)
(09/13)
(09/12)
(09/06)
(08/30)
(08/30)
(03/01)
(02/21)
(11/29)
(09/18)
(06/14)
(05/25)
(05/25)
(05/17)
(05/11)
(02/23)
(02/22)
(02/02)
(12/08)
(11/16)
(11/16)
(11/04)
最古記事
(06/30)
(07/01)
(07/04)
(07/07)
(07/16)
(07/18)
(07/21)
(07/21)
(07/25)
(07/29)
(08/19)
(08/27)
(08/31)
(09/09)
(09/16)
(09/22)
(09/22)
(09/28)
(04/06)
(04/20)
(04/29)
(04/30)
(06/21)
(06/23)
(06/26)

Comment

お名前
タイトル
E-MAIL
URL
コメント
パスワード

Copyright © インフラエンジニアのVPS徹底比較 : All rights reserved

TemplateDesign by KARMA7

忍者ブログ [PR]

管理人限定

広告検索

Custom Search

おすすめ記事一覧

VPSのサービス/機能比較

VPSのサービス比較(大手VPS)
VPSのサービス比較(EC or 拡張性)
VPSのサービス比較(注目のVPS)
VPSのサービス比較(運用サービス充実VPS)

おすすめVPS紹介

個人向けベストTOP3 VPS
法人向けベストTOP3 VPS
法人向けVPSで確認すべきこと
個人向けVPSで確認すべきこと

VPSの用途/目的別比較

ASP.NETが利用可能な
 WindowsVPSの比較

MS SQL SERVERが利用可能な
 WindowsVPSの比較

安定した仮想化エンジンで比較するVPS
初心者でも管理可能なVPS
VPSのマネージドサービス比較
セキュリティサービス(IPS,FW)が充実したVPS
監視サービスで選ぶVPS
拡張性で選ぶVPS
Linux系OSで複数台構成ができるVPS
Windowsで複数台構成ができるVPS
VPSのサーバ構成
開発環境/コンテンツ確認用としてのVPS活用

クラウドサービス関連記事

クラウドコンピューティングWindows Azure
ハウジング、ホスティング(VPS)とIaaSの比較
日本国内のAWS互換クラウド マルチクラウド比較


VPSでのセキュリティ

セキュリティ重視したVPS
セキュリティ診断ASPで脆弱性を無くす

サーバ運用・管理

初心者でも管理可能なVPS
WEB操作でサーバ管理
VPSのマネージドサービス比較

FX用VPS(リモートデスクトップ)

FX自動売買環境としてのWindowsVPS
 (リモートデスクトップ)比較

FX用VPS環境を安くする

BCP/DRサイトとして利用するVPS

電力会社管内別のVPS 【BCP/DR対策】
東京電力会社管内のVPS
関西電力会社管内のVPS

VPSの価格比較

Linux系VPSの価格比較
月額ワンコインで借りられるVPS
ASP.NETが利用可能なVPSの価格比較

VPS注意点

VPSで注意すべきこと
VPSの契約前に確認すること
SWAP領域が扱えるVPS

各VPS業者のお得情報

各VPS業者のキャンペーン情報
FXシステムトレード用VPSを無料にする

おすすめVPS業者

conoha VPSの詳細と評価/評判
お名前.com VPS(KVM)の詳細と評価/評判
さくらVPSの詳細と評価/評判
ServersMan@VPの詳細と評価/評判
@YMCのVPSの詳細と評価/評判
WebARENA SuiteProの詳細と評価/評判
WebARENA VPSクラウドの詳細と評価/評判
VirtualWebの詳細と評価/評判
ABLENETのVPSの詳細と評価/評判
 ・ABLENETのコントロールパネル
 ・ABLENETの申請手順
 ・ABLENETでのOSインストール手順
SpeeverのVPSの詳細と評価/評判
GMOクラウドVPSの詳細と評価/評判
使えるねっとVPSの詳細と評価/評判
SEEDS VPSの詳細と評価/評判
SPPD VPSの詳細と評価/評判
ServerQueen(Linux)の詳細と評価/評判

おすすめクラウドサービス

WebARENA VPSクラウドの詳細と評価/評判
GMOクラウドPublicの詳細と評価/評判
NTTCom CloudNの詳細と評価/評判

設定手順

初心者でもできるApache設定
初心者でもできるPHP設定
初心者でもできるMySQL設定

広告

広告2



バーコード

広告2