気ままに

プログラム関連で困ったことを調べて気ままに投稿

Docker Composeでmysql の書き込みできないエラーが出たときの対処方法

docker-compose でmysqlを起動しようとした時に、以下のようなエラーが出て何やってもmysqlが起動できないときの対処方法。

db_1     | 2018-09-01 00:15:05 0 [Note] mysqld (mysqld 5.6.41) starting as process 1 ...
db_1     | 2018-09-01 00:15:05 1 [Note] Plugin 'FEDERATED' is disabled.
db_1     | mysqld: Unknown storage engine 'InnoDB'
db_1     | 2018-09-01 00:15:05 1 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: The InnoDB memory heap is disabled
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Memory barrier is not used
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Compressed tables use zlib 1.2.3
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Using Linux native AIO
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Using CPU crc32 instructions
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Completed initialization of buffer pool
db_1     | 2018-09-01 00:15:05 1 [Note] InnoDB: Highest supported file format is Barracuda.
db_1     | InnoDB: No valid checkpoint found.
db_1     | InnoDB: If you are attempting downgrade from MySQL 5.7.9 or later,
db_1     | InnoDB: please refer to http://dev.mysql.com/doc/refman/5.6/en/upgrading-downgrading.html
db_1     | InnoDB: If this error appears when you are creating an InnoDB database,
db_1     | InnoDB: the problem may be that during an earlier attempt you managed
db_1     | InnoDB: to create the InnoDB data files, but log file creation failed.
db_1     | InnoDB: If that is the case, please refer to
db_1     | InnoDB: http://dev.mysql.com/doc/refman/5.6/en/error-creating-innodb.html
db_1     | 2018-09-01 00:15:05 1 [ERROR] Plugin 'InnoDB' init function returned error.
db_1     | 2018-09-01 00:15:05 1 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
db_1     | 2018-09-01 00:15:05 1 [ERROR] Unknown/unsupported storage engine: InnoDB
db_1     | 2018-09-01 00:15:05 1 [ERROR] Aborting
db_1     |
db_1     | 2018-09-01 00:15:05 1 [Note] Binlog end
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'partition'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_FT_DELETED'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_METRICS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_CMPMEM'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_CMP_RESET'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_CMP'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_LOCKS'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'INNODB_TRX'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'BLACKHOLE'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'ARCHIVE'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'MRG_MYISAM'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'MyISAM'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'MEMORY'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'CSV'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'sha256_password'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'mysql_old_password'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'mysql_native_password'
db_1     | 2018-09-01 00:15:05 1 [Note] Shutting down plugin 'binlog'
db_1     | 2018-09-01 00:15:05 1 [Note] mysqld: Shutdown complete
続きを読む

【AWS】PHPでローカルとS3のファイルを同期する処理を作ってみたよ

サイトにアップされた画像をS3に個別にアップしようと思ったけど、すでに処理が書かれているプログラムを改修するのが大変だったので、 画像アップのディレクトリごとS3にアップすることにしたよ。

以下のAmazonのサイトを参考にしながら書いたんだけど、ソースコードが通してで書かれていないので、個別に実行してもアップできない。。 なので、動くプログラムを公開 Amazon S3 Transfer Manager - AWS SDK for PHP

続きを読む

【AWS】PHPからS3に画像をアップロードする

AWS SDKのバージョン3を使って、S3にファイルをアップロードしようとしたハマってしまったので、 自分のメモも兼ねて書いておこう。

composerを使って、AWS SDK の3系をインストール。まずは、composer.jsonを編集

{
        "aws/aws-sdk-php": "3.*"
}

composerをインストール

 $ composer update
続きを読む

【Heroku】サイトのURLを強制的にhttpsにする方法(メモ)

サイトのURLを強制的にhttpsにする方法について、.htaccessをドキュメントルートに設置し、以下のように書く

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} ^http$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

そして、デプロイ

git push heroku master

そうするとサイトのURLが強制的にhttpからhttpsになる。

続きを読む

【AWS】CloudFrontのIPアドレス範囲を調べる方法

今やっているサイトにCloudFrontを導入しようとした時に、検証用サーバではbasic認証を書けると、CloudFront側でも認証画面になり、 無限ループみたいになっていたので、IP制限でCloudFrontからのアクセスはbasic認証なしで見えるようにした話。

続きを読む