質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Q&A

1回答

8746閲覧

my.cnfの設定について

kumakumatan

総合スコア213

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

0グッド

0クリップ

投稿2016/03/04 10:58

編集2016/03/08 09:42

Mysql Cominity Server 5.7.11にてmy.cnfの設定をしています。
・max_connections = 500
・文字コード:UTF8
・DBファイルシステム領域について(1000M)自動作成をする
・log_timestamps = 'system'
・lower_case_table_names = 2
事をしたいと思います。my.cnfを下記のように設定しました。
ログ時刻は現在の時刻になっているみたいなのですが、最初の1行だけ時刻がずれているのは
何故でしょうか?デーモンユーザで起動しているのでしょうか?
lower_case_table_names = 2にしてもmysqlに反映されません。記述が間違っているのでしょうか?
また、起動ログで注意、エラーが多い気がするのですが、問題ないでしょうか?
必要のない記述があれば教えて下さい。

my.cnf

1# For advice on how to change settings please see 2# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html 3[mysqld] 4# 5# Remove leading # and set to the amount of RAM for the most important data 6# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. 7# innodb_buffer_pool_size = 128M 8# 9# Remove leading # to turn on a very important data integrity option: logging 10# changes to the binary log between backups. 11# log_bin 12# 13# Remove leading # to set options mainly useful for reporting servers. 14# The server defaults are faster for transactions and fast SELECTs. 15# Adjust sizes as needed, experiment to find the optimal values. 16# join_buffer_size = 128M 17# sort_buffer_size = 2M 18# read_rnd_buffer_size = 2M 19log_timestamps = 'system' 20lower_case_table_names = 2 21datadir=/var/lib/mysql 22socket=/var/lib/mysql/mysql.sock 23# Disabling symbolic-links is recommended to prevent assorted security risks 24symbolic-links=0 25character-set-server = utf8 26skip-character-set-client-handshake 27# -------------------------------------------------- 28# Network 29# -------------------------------------------------- 30max_connections = 500 31# -------------------------------------------------- 32# Logging 33# -------------------------------------------------- 34general_log=1 35general_log_file=/var/log/mysql_query.log 36# -------------------------------------------------- 37# Cache & Memory 38# -------------------------------------------------- 39# Global 40thread_cache_size = 30 41table_open_cache = 400 42query_cache_size = 16M 43query_cache_limit = 1M 44# Global, Session 45max_heap_table_size = 16M 46tmp_table_size = 16M 47sort_buffer_size = 2M 48read_buffer_size = 131072 49join_buffer_size = 131072 50read_rnd_buffer_size = 262144 51# -------------------------------------------------------------------- 52# InnoDB behavior 53# -------------------------------------------------------------------- 54# Global 55innodb_file_format = Barracuda 56innodb_write_io_threads = 4 57innodb_read_io_threads = 4 58innodb_stats_on_metadata = 1 59innodb_max_dirty_pages_pct = 90 60innodb_adaptive_hash_index = 1 61innodb_adaptive_flushing = 1 62innodb_strict_mode = 1 63innodb_io_capacity = 200 64innodb_autoinc_lock_mode = 1 65innodb_change_buffering = inserts 66innodb_old_blocks_time = 500 67# -------------------------------------------------------------------- 68# InnoDB base 69# -------------------------------------------------------------------- 70# Global 71innodb_buffer_pool_size = 256M 72innodb_data_home_dir = /var/lib/mysql 73innodb_data_file_path = ibdata1:1000M:autoextend 74innodb_file_per_table = 1 75innodb_autoextend_increment = 64M 76innodb_log_group_home_dir = /var/lib/mysql 77innodb_fast_shutdown = 0 78innodb_log_file_size = 64M 79innodb_log_files_in_group = 2 80innodb_log_buffer_size = 8M 81#innodb_additional_mem_pool_size = 8M 82innodb_thread_concurrency = 8 83innodb_flush_log_at_trx_commit = 1 84innodb_force_recovery = 0 85innodb_doublewrite = 1 86innodb_sync_spin_loops = 20 87innodb_thread_sleep_delay = 1000 88innodb_commit_concurrency = 0 89innodb_concurrency_tickets = 500 90# Global, Session 91innodb_support_xa = FALSE 92innodb_lock_wait_timeout = 50 93innodb_table_locks = 1 94[client] 95default-character-set = utf8 96[mysqldump] 97default-character-set = utf8 98[mysql] 99default-character-set = utf8 100[mysqld_safe] 101log-error=/var/log/mysqld.log 102pid-file=/var/run/mysqld/mysqld.pid

-----------------/var/log/mysqld.log-------------------

2016-03-08T08:54:41.930740Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 2016-03-08T17:54:42.139845+09:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-03-08T17:54:42.140663+09:00 0 [Note] /usr/sbin/mysqld (mysqld 5.7.11-log) starting as process 21803 ... 2016-03-08T17:54:42.146232+09:00 0 [Warning] option 'innodb-autoextend-increment': unsigned value 67108864 adjusted to 1000 2016-03-08T17:54:42.146718+09:00 0 [Warning] InnoDB: Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed. 2016-03-08T17:54:42.146740+09:00 0 [Warning] InnoDB: Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html 2016-03-08T17:54:42.146833+09:00 0 [Note] InnoDB: PUNCH HOLE support available 2016-03-08T17:54:42.146867+09:00 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2016-03-08T17:54:42.146880+09:00 0 [Note] InnoDB: Uses event mutexes 2016-03-08T17:54:42.146890+09:00 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier 2016-03-08T17:54:42.146900+09:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-03-08T17:54:42.146912+09:00 0 [Note] InnoDB: Using Linux native AIO 2016-03-08T17:54:42.147453+09:00 0 [Note] InnoDB: Number of pools: 1 2016-03-08T17:54:42.147610+09:00 0 [Note] InnoDB: Not using CPU crc32 instructions 2016-03-08T17:54:42.157075+09:00 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M 2016-03-08T17:54:42.180181+09:00 0 [Note] InnoDB: Completed initialization of buffer pool 2016-03-08T17:54:42.184575+09:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2016-03-08T17:54:42.197089+09:00 0 [Note] InnoDB: Highest supported file format is Barracuda. 2016-03-08T17:54:42.223241+09:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2016-03-08T17:54:42.223353+09:00 0 [Note] InnoDB: Setting file '/var/lib/mysql/ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2016-03-08T17:54:42.364921+09:00 0 [Note] InnoDB: File '/var/lib/mysql/ibtmp1' size is now 12 MB. 2016-03-08T17:54:42.366681+09:00 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2016-03-08T17:54:42.366707+09:00 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2016-03-08T17:54:42.368574+09:00 0 [Note] InnoDB: Waiting for purge to start 2016-03-08T17:54:42.418823+09:00 0 [Note] InnoDB: 5.7.11 started; log sequence number 1209999 2016-03-08T17:54:42.420939+09:00 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 2016-03-08T17:54:42.421367+09:00 0 [Note] Plugin 'FEDERATED' is disabled. 2016-03-08T17:54:42.421368+09:00 0 [Note] InnoDB: Buffer pool(s) load completed at 160308 17:54:42 2016-03-08T17:54:42.421969+09:00 0 [Warning] InnoDB: Cannot open table mysql/plugin from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue. mysqld: Table 'mysql.plugin' doesn't exist 2016-03-08T17:54:42.422038+09:00 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. mysqld: File '/var/log/mysql_query.log' not found (Errcode: 13 - Permission denied) 2016-03-08T17:54:42.422293+09:00 0 [ERROR] Could not use /var/log/mysql_query.log for logging (error 13 - Permission denied). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL GENERAL_LOG=ON" or restart the MySQL server. 2016-03-08T17:54:42.423054+09:00 0 [Warning] InnoDB: Cannot open table mysql/gtid_executed from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue. mysqld: Table 'mysql.gtid_executed' doesn't exist 2016-03-08T17:54:42.423118+09:00 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2016-03-08T17:54:42.423163+09:00 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 2016-03-08T17:54:42.423544+09:00 0 [Warning] CA certificate ca.pem is self signed. 2016-03-08T17:54:42.426320+09:00 0 [Note] Server hostname (bind-address): '*'; port: 3306 2016-03-08T17:54:42.427687+09:00 0 [Note] IPv6 is not available. 2016-03-08T17:54:42.427748+09:00 0 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 2016-03-08T17:54:42.427769+09:00 0 [Note] Server socket created on IP: '0.0.0.0'. 2016-03-08T17:54:42.431671+09:00 0 [Warning] InnoDB: Cannot open table mysql/server_cost from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue. 2016-03-08T17:54:42.431711+09:00 0 [Warning] Failed to open optimizer cost constant tables 2016-03-08T17:54:42.432742+09:00 0 [Warning] InnoDB: Cannot open table mysql/time_zone_leap_second from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

-----------mysqld.log----

以上、ご教授をお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

dupont_kedama

2016/03/04 11:06 編集

引用部分全体を ``` と ``` で囲んでいただくと読みやすいかも。
CHERRY

2016/03/04 12:25

「サービスが開始になりません。 」というのは、設定を変更後どのようなコマンドを実行されたのでしょうか? エラーメッセージは、何か出ていませんか?
kumakumatan

2016/03/07 06:38

ご返信ありがとうございます。 少し、my.cnfファイルを修正しました。 =======my.cnf================================ # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 character-set-server = utf8 skip-character-set-client-handshake # -------------------------------------------------- # Network # -------------------------------------------------- max_connections = 500 # -------------------------------------------------- # Logging # -------------------------------------------------- general_log=1 general_log_file=/var/log/mysql_query.log # -------------------------------------------------- # Cache & Memory # -------------------------------------------------- # Global thread_cache_size = 30 table_open_cache = 400 query_cache_size = 16M query_cache_limit = 1M # Global, Session max_heap_table_size = 16M tmp_table_size = 16M sort_buffer_size = 2M read_buffer_size = 131072 join_buffer_size = 131072 read_rnd_buffer_size = 262144 # -------------------------------------------------------------------- # InnoDB behavior # -------------------------------------------------------------------- # Global innodb_file_format = Barracuda innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_stats_on_metadata = 1 innodb_max_dirty_pages_pct = 90 innodb_adaptive_hash_index = 1 innodb_adaptive_flushing = 1 innodb_strict_mode = 1 innodb_io_capacity = 200 innodb_autoinc_lock_mode = 1 innodb_change_buffering = inserts innodb_old_blocks_time = 500 # -------------------------------------------------------------------- # InnoDB base # -------------------------------------------------------------------- # Global innodb_buffer_pool_size = 256M innodb_data_home_dir = /var/lib/mysql innodb_data_file_path = ibdata1:1000M:autoextend innodb_file_per_table = 1 innodb_autoextend_increment = 64M innodb_log_group_home_dir = /var/lib/mysql innodb_fast_shutdown = 0 innodb_log_file_size = 64M innodb_log_files_in_group = 2 innodb_log_buffer_size = 8M innodb_additional_mem_pool_size = 8M innodb_thread_concurrency = 8 innodb_flush_log_at_trx_commit = 1 innodb_force_recovery = 0 innodb_doublewrite = 1 innodb_sync_spin_loops = 20 innodb_thread_sleep_delay = 1000 innodb_commit_concurrency = 0 innodb_concurrency_tickets = 500 # Global, Session innodb_support_xa = FALSE innodb_lock_wait_timeout = 50 innodb_table_locks = 1 [client] default-character-set = utf8 [mysqldump] default-character-set = utf8 [mysql] default-character-set = utf8 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid =========my.cnf=============== エラーログは ======mysqld.log============================= 2016-03-07T06:16:14.577629Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-03-07T06:16:14.583794Z 0 [Warning] option 'innodb-autoextend-increment': unsigned value 67108864 adjusted to 1000 2016-03-07T06:16:14.584335Z 0 [Warning] InnoDB: Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed. 2016-03-07T06:16:14.584356Z 0 [Warning] InnoDB: Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html 16-03-07T06:16:17.142266Z 0 [Warning] InnoDB: New log files created, LSN=45790 16-03-07T06:16:17.434115Z 0 [Warning] InnoDB: Cannot open table mysql/plugin from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue. mysqld: Table 'mysql.plugin' doesn't exist 2016-03-07T06:16:17.434185Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2016-03-07T06:16:17.434390Z 0 [ERROR] unknown variable 'innodb_additional_mem_pool_size=8M' 2016-03-07T06:16:17.434407Z 0 [ERROR] Aborting =========Logを一部抜粋======================== InnoDBの設定を入れてから起動しません。InnoDBの設定を外したら、正常起動できます。 ご回答宜しくお願いします。
dupont_kedama

2016/03/07 06:45

質問文本文を編集して my.conf の内容、エラーの内容それぞれの上下を ``` と ``` で囲んでください。(</>のボタンがその入力支援になっています)
guest

回答1

0

質問文にあわせて回答も編集しました

起動しない原因(推測)

このmy.cnfは前のバージョンで使用していたものでしょうか。
MySQL5.7では設定できないパラメーターが含まれているのが原因かと思われます。

できることならまるごとコピペするのではなく、まっさらな状態から一つ一つMySQL5.7で使えるパラメーターと意味を確認しながらmy.cnfを作ることをお勧めします。
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html

意地悪せずに答えを書くと「innodb_additional_mem_pool_size」が MySQL5.7.4で削除されており、そのパラメータを消さないとおそらく起動しません。
http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_additional_mem_pool_size

ちなみにmy.cnfに何も書かなくてもinnodbは(標準の設定値で)使えます。

ログファイルの時刻

ログファイルの時刻の標準はUTCになっています。
my.cnfに
log_timestamps = 'system'
を書けばOSの時刻になります。
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_log_timestamps

同時接続

以下私の理解での回答です。
「同時接続数」はmax_connectionsで制御するのでコネクションプールだろうと何だろうと共通です。
MySQLの場合はその利用シーン(接続元言語仕様)からコネクションプールせずに接続切断の連続をする方が多い気がします。
Oracle社もそれを承知していて最新版の5.7では接続切断が多くてもコストが低くなるような調整をしています。
MySQLの接続についてのパフォーマンスチューニングはmax_connectionsとthread_cacheについて行う情報が多く見つかるので参考にされるとよいかもしれません。

回答追記20160308

最初の1行だけ時刻がずれている

ずれているのではなく表現が違うだけです。あまり気にするところではないと思います。

lower_case_table_names = 2にしてもmysqlに反映されません

「反映されません」が具体的に何をして何になるのかはわかりませんが、これを設定してもInnoDBではすべて小文字になります。
https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html

起動ログで注意、エラーが多い気がする

推測ですが、旧バージョンのデータを引き継いでますか?そうだとしてmysql_upgradeをしてますか?
これ以外については私からは一つずつ指摘しません。1行ずつ意味を調べてみてください。
無視してよいものとすべきでないものがあります。

innodbは標準の設定値でどのような仕様で使えるのでしょか?

ここのデフォルト値が書いてあります。
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html

投稿2016/03/05 01:37

編集2016/03/08 10:20
dupont_kedama

総合スコア925

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kumakumatan

2016/03/08 09:44

ご回答ありがとうございます。innodbは標準の設定値でどのような仕様で使えるのでしょか?また、質問文も変更しましたので、お時間のある時にご回答をお願いします。 宜しくお願いします。
dupont_kedama

2016/03/08 10:06

コメントだと読みづらいので回答を編集します。
kumakumatan

2016/03/09 00:33

ご回答ありがとうございます。 https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html ですが、日本語サイトみたいのがあったりするのでしょうか? すべて英語で書かれていて、私の頭では理解するのが難しいです。 InnoDBでは、大文字、小文字を区別しないようにするのはできないのでしょうか? どこにどう設定していいのかわかりません。。 innodbの標準設定値も日本語で書かれているところはあるのでしょうか? 以上、宜しくお願いします。
dupont_kedama

2016/03/09 00:43 編集

MySQL5.7のマニュアルはまだ日本語化されていません。 当該の情報はMySQL5.6のころと大きく変わっていないはずなので、 https://dev.mysql.com/doc/refman/5.6/ja/identifier-case-sensitivity.html を参考にされるとよいと思います。 innodbの標準設定値については5.6と違う点が多いはずですが、意味がわからなくて苦心されているのであれば5.6の日本語マニュアルと見比べながら確認いただくのがよいかと思います。 http://dev.mysql.com/doc/refman/5.6/ja/server-system-variables.html
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問