スティーブジョブスに俺はなる!!

毎日全力を出し切り、自分史上最高を出し続けたい!

Grails - Error Server failed to start for port 8080: Address already in use

% grails run-app 
:run
| Loading Grails 2.4.4
| Configuring classpath
| Running pre-compiled script
| Environment set to development
| Packaging Grails application
| Running Grails application
| Error Server failed to start for port 8080: Address already in use (Use --stacktrace to see the full trace)

 

コマンドを実行

% lsof -w -n -i tcp:8080 
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 3571 spacenet 27u IPv6 2469651 0t0 TCP *:http-alt (LISTEN)

プロセスをキルする

% kill -9 3571

 

もう一回 run-app すればOK

% grails run-app
:run
| Loading Grails 2.4.4
| Configuring classpath

| Running pre-compiled script.
| Environment set to development
| Packaging Grails application
| Running Grails application

| Server running. Browse to http://localhost:8080/

Grails Database Migration Plugin まとめ

前提Grails 2.4.4

 

2種類ある

1:データベースの内容を見て差分更新する。

2:GORM(domain クラス)の内容を見て差分更新する。

 

最初のステップ

DataSource.groovyの修正

全環境のdbCreateをコメントアウトする。

create-drop、updateになってると思うが、Database Migration Pluginの差分更新と競合してしまうために機能しないようにする必要がある。

 

Database Migration Pluginを使い始めたら、以後はDatabase Migration Plugin経由でテーブルの変更を行う必要が有る。dbCreateをコメントアウトしているので、domain変更したからって自動的にテーブルが変更されなくなる。

 

それでは導入を始める。

まずは、現状を記録する。

1の場合
grails
dbm-generate-changelog changelog.groovy
2の場合
grails
dbm-generate-gorm-changelog changelog.groovy

 

grails-app/migrations/changelog.groovyというファイルが出来ればOK。

 

次に、現時点までの変更を記録する。

テーブルを追加するので開発環境のMYSQLを起動させる。

grails dbm-changelog-sync

 

これにより、changelog.groovyに記載された内容までテーブルに適応されたという状態がlogに記録される。

開発環境のDBには変更管理用のテーブルが二つ(databasechangelogとdatabasechangeloglock)できる。

 

以上で初期準備は完了。

 

以後、domainを変更した際はDatabase Migration Plugin経由でデータベースの変更を行う。

 

変更の仕方。

まずは、あるdomainを変更。

コマンド実行(ファイル名は適切に考える、最後の--addは忘れずに)

grails dbm-gorm-diff 2015-5-31-table-added.groovy --add

※最後の--addを忘れるとファイルしかできないので、手動でchangelog.groovyにファイル名を追記する。

データベースに変更を適用。

grails dbm-update

 

 

本番デプロイ準備

Config.groovyに以下を追記して、自動で変更を適用するようにする。

grails.plugin.databasemigration. updateOnStart = true
grails.plugin.databasemigration. updateOnStartFileNames = ['changelog.groovy']

あとは普通にデプロイすればOK

 

qiita.com

LinuxにインストールしたMySQL5.6を使おうとしたら早速エラー発生

MySQLを使おうとしたら早速エラー

InnoDB: Error: Table "mysql"."innodb_table_stats" not found.

 

どうやらMySQLのバグらしいので、関連テーブル削除と関連ファイル削除を実行し、テーブルを作り直す。

% mysql -u root -p

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 5.6.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

 

mysql> drop table innodb_index_stats;
ERROR 1051 (42S02): Unknown table 'mysql.innodb_index_stats'

 

mysql> drop table innodb_table_stats;
ERROR 1051 (42S02): Unknown table 'mysql.innodb_table_stats'

 

mysql> drop table slave_master_info;
ERROR 1051 (42S02): Unknown table 'mysql.slave_master_info'

 

mysql> drop table slave_relay_log_info;
ERROR 1051 (42S02): Unknown table 'mysql.slave_relay_log_info'

 

mysql> drop table slave_worker_info;
ERROR 1051 (42S02): Unknown table 'mysql.slave_worker_info'

 

mysql> exit
Bye

 

% cd /var/lib/mysql/mysql

% sudo rm -rf innodb_index_stats*
zsh: no matches found: innodb_index_stats*

 

% sudo rm -rf innodb_table_stats*

zsh: no matches found: innodb_table_stats*

 

% sudo rm -rf slave_master_info*
zsh: no matches found: slave_master_info*

 

% sudo rm -rf slave_relay_log_info*
zsh: no matches found: slave_relay_log_info*

 

% sudo rm -rf slave_worker_info*
zsh: no matches found: slave_worker_info*

 

以下のSQL文を実行

http://bugs.mysql.com/file.php?id=19725&bug_id=67179&text=1

% mysql -u root -p
Enter password:

データベースをmysqlに変更

mysql> use mysql;

上記リンクのSQL文実行

Database changed
mysql> /*
/*> temporary fix for problem with windows installer for MySQL 5.6.10 on Windows 7 machines.
/*> I did the procedure on a clean installed MySql, and it worked for me, at least it stopped
/*> lines of innodb errors in the log and the use of transient innodb tables. So, do it at
/*> your own risk..
/*>
/*> 1. drop these tables from mysql:
/*> innodb_index_stats
/*> innodb_table_stats
/*> slave_master_info
/*> slave_relay_log_info
/*> slave_worker_info
/*>
/*> 2. delete all .frm & .ibd of the tables above.
/*>
/*> 3. run this file to recreate the tables above (source five-tables.sql).
/*>
/*> 4. restart mysqld.
/*>
/*> Cheers,
/*> CNL
/*> */
mysql>
mysql> CREATE TABLE `innodb_index_stats` (
-> `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
-> `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
-> `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
-> `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-> `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
-> `stat_value` bigint(20) unsigned NOT NULL,
-> `sample_size` bigint(20) unsigned DEFAULT NULL,
-> `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
-> PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
master.',
`Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
`Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.',
`User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
`User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
`Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
`Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
`Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
`Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
`Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
`Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
`Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
`Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
`Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
`Heartbeat` float NOT NULL,
`Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
`Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
`Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
`Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
`Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
`Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
`Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
PRIMARY KEY (`Host`,`Port`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';

CREATE TABLE `slave_relay_log_info` (
`Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
`Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
`Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
`Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
`Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
`Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
`Number_of_workers` int(10) unsigned NOQuery OK, 0 rows affected (0.14 sec)

mysql>
mysql> CREATE TABLE `innodb_table_stats` (
-> `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
-> `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
-> `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-> `n_rows` bigint(20) unsigned NOT NULL,
-> `clustered_index_size` bigint(20) unsigned NOT NULL,
-> `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
-> PRIMARY KEY (`database_name`,`table_name`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
O
Query OK, 0 rows affected (0.07 sec)

mysql>
mysql> CREATE TABLE `slave_master_info` (
-> `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
-> `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
-> `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
-> `Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.',
-> `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
-> `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
-> `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
-> `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
-> `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
-> `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
-> `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
-> `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
-> `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
-> `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
-> `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
-> `Heartbeat` float NOT NULL,
-> `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
-> `Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
-> `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
-> `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
-> `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
-> `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
-> `Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
-> PRIMARY KEY (`Host`,`Port`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';
Query OK, 0 rows affected (0.07 sec)

mysql>
mysql> CREATE TABLE `slave_relay_log_info` (
-> `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
-> `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
-> `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
-> `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
-> `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
-> `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
-> `Number_of_workers` int(10) unsigned NOT NULL,
-> `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
-> PRIMARY KEY (`Id`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information';
Query OK, 0 rows affected (0.13 sec)

mysql>
mysql> CREATE TABLE `slave_worker_info` (
-> `Id` int(10) unsigned NOT NULL,
-> `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Relay_log_pos` bigint(20) unsigned NOT NULL,
-> `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Master_log_pos` bigint(20) unsigned NO
-> `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
-> `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
-> `Checkpoint_seqno` int(10) unsigned NOT NULL,
-> `Checkpoint_group_size` int(10) unsigned NOT NULL,
-> `Checkpoint_group_bitmap` blob NOT NULL,
-> PRIMARY KEY (`Id`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NO
`Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NU' at line 6

ちゃんとコピーできてなく、ERRORになったのでやり直し。

mysql> CREATE TABLE `slave_worker_info` (
-> `Id` int(10) unsigned NOT NULL,
-> `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Relay_log_pos` bigint(20) unsigned NOT NULL,
-> `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Master_log_pos` bigint(20) unsigned NOT NULL,
-> `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
-> `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-> `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
-> `Checkpoint_seqno` int(10) unsigned NOT NULL,
-> `Checkpoint_group_size` int(10) unsigned NOT NULL,
-> `Checkpoint_group_bitmap` blob NOT NULL,
-> PRIMARY KEY (`Id`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information';
Query OK, 0 rows affected (0.10 sec)

mysql> exit
Bye

 

% sudo service mysqld restart
[sudo] password for user:
Stopping mysqld: [ OK ]
Starting mysqld:[ OK ]

LinuxにMySQLをyumでインストールではまった・・・

yumリポジトリ取得

OS確認

$ uname -a

Linux fxch.jp 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux

つまり、これだ→Hat Enterprise Linux 6 / Oracle Linux 6

以下のリンク先から該当のファイルをダウンロードする

MySQL :: Download MySQL Yum Repository

$ wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

ダウンロードしたyumを適用

$ sudo yum localinstall mysql-community-release-el6-5.noarch.rpm

中略

インストール:
mysql-community-release.noarch 0:el6-5

完了しました!

 

確認してみる

$ yum repolist enabled | grep "mysql.*-community.*"

mysql-connectors-community MySQL Connectors Community 14
mysql-tools-community MySQL Tools Community 23
mysql56-community MySQL 5.6 Community Server 146

 

インストール可能なのは以下の通り

$ yum repolist all | grep mysql
mysql-connectors-community MySQL Connectors Community 有効: 14
mysql-connectors-community-source MySQL Connectors Community - Sourc 無効
mysql-tools-community MySQL Tools Community 有効: 23
mysql-tools-community-source MySQL Tools Community - Source 無効
mysql55-community MySQL 5.5 Community Server 無効
mysql55-community-source MySQL 5.5 Community Server - Sourc 無効
mysql56-community MySQL 5.6 Community Server 有効: 146
mysql56-community-source MySQL 5.6 Community Server - Sourc 無効
mysql57-community-dmr MySQL 5.7 Community Server Develop 無効
mysql57-community-dmr-source MySQL 5.7 Community Server Develop 無効


私のLinuxにはmysql 5.1がデフォルトで入ってるがいらないので、削除
$ sudo yum remove mysql
中略
削除しました:
mysql.x86_64 0:5.1.73-3.el6_5

依存性の削除をしました:
mysql-server.x86_64 0:5.1.73-3.el6_5

完了しました!

改めてインストール
$
sudo yum install mysql-community-server
インストール:
mysql-community-libs.x86_64 0:5.6.24-3.el6
mysql-community-libs-compat.x86_64 0:5.6.24-3.el6
mysql-community-server.x86_64 0:5.6.24-3.el6

依存性関連をインストールしました:
libaio.x86_64 0:0.3.107-10.el6
mysql-community-client.x86_64 0:5.6.24-3.el6
mysql-community-common.x86_64 0:5.6.24-3.el6

置換:
mysql-libs.x86_64 0:5.1.73-3.el6_5

完了しました!

さて、mysql起動してみますか!
% sudo service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

あh???エラー発生・・・
% sudo tail -100f /var/log/mysqld.log
[ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2015-05-24 22:43:37 10323 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2015-05-24 22:43:37 10323 [ERROR] Plugin 'InnoDB' init function returned error.
2015-05-24 22:43:37 10323 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-05-24 22:43:37 10323 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-05-24 22:43:37 10323 [ERROR] Aborting

よくわからないがファイルが悪いらしい
% cd /var/lib/mysql
% sudo mv ibdata1 ibdata1_bk

再度、mysql起動!おらーーーー!!!!
% sudo service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

エラー発生・・・
% sudo tail -100f /var/log/mysqld.log
[ERROR] InnoDB: Cannot create ./ib_logfile1
2015-05-24 22:45:11 10588 [ERROR] Plugin 'InnoDB' init function returned error.
2015-05-24 22:45:11 10588 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-05-24 22:45:11 10588 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-05-24 22:45:11 10588 [ERROR] Aborting

おっ、エラー変わった!
よくわからないが適当に
% cd /var/lib/mysql
% sudo mv ib_logfile1 ib_logfile_bk

おらーーーー!!!!
% sudo service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

[Warning] InnoDB: Doublewrite does not have page_no=0 of space: 0
[ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
どうやらだめだったらしい、元に戻す
% cd /var/lib/mysql
% sudo cp -p ib_logfile_bk ib_logfile1

調査

osx - MySQL doesn't starts on AMPPS OS X - Stack Overflow


設定変更してみる。
% sudo vi /etc/my.cnf
[mysqld]の下に以下を挿入
innodb_force_recovery = 1

おらーーーー!!!!
% sudo service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

動きませんが?
% sudo tail -100f /var/log/mysqld.log
InnoDB: Assertion failure in thread 140398945199904 in file fsp0fsp.cc line 1849
InnoDB: Failing assertion: inode
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
14:06:34 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

エンドレスエラー突入っぽい。
俗に言うあれですね、「ハマった💦」

てか、innodb force recoveryなんてやっていいのかよ?w

MySQL Bugs: #74876: InnoDB: Failing assertion: inode in file fsp0fsp.cc line 1887 | fseg_inode_get

調べたらわけわからない事になってるので他の方法探す。

 

% sudo vi /etc/my.cnf
さっき追加したのを削除
削除→innodb_force_recovery = 1

またここに戻る
% cd /var/lib/mysql
先頭がibから始まるファイル全部退避
% sudo mv ibdata1 ibdata1_bk
% sudo mv ib_logfile0 ib_logfile0_bk
% sudo mv ib_logfile1 ib_logfile1_bk
% sudo mv ib_logfile101 ib_logfile101_bk

おらーーーーーーーー!!!!
% sudo service mysqld start
Starting mysqld: [  OK  ]

成功????

% sudo service mysqld status
mysqld (pid 12994) is running...

^^v

インスト終わったら、セキュリティ大事よ
% sudo mysql_secure_installation
rootのパスワード設定
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
またかよ・・・・

Control + C で脱出

そけっとくらいつくっとk−ーーーーーーー
% sudo touch /var/lib/mysql/mysql.sock 
% sudo chown mysql:mysql /var/lib/mysql/mysql.sock


% sudo mysql_secure_installation
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
ん??????

[Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.24' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
2015-05-24 23:49:11 13447 [Note] /usr/sbin/mysqld: Normal shutdown

ポート開いてない系?
まあ、開けた覚えないけどさ・・・・

一行追加
% sudo vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
% sudo service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]

% sudo mysql_secure_installation Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
ん??????

% sudo service mysqld start
Starting mysqld: [ OK ]

% sudo mysql_secure_installation
入力なしでEnter
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:
ERROR 1054 (42S22) at line 1: Unknown column 'plugin' in 'where clause'
old password update failed!
Cleaning up...


またエラー〜????

もう一回やってみる・・

% sudo 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
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

え?設定されてるの???
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.

You already have a root password set, so you can safely answer 'n'.

設定されてるのでn
Change the root password? [Y/n]n

エラーになって設定されているという怖いパターン。
後で破片が問題にならなければいいが・・・・

Remove anonymous users? [Y/n] Y
... Success!
Disallow root login remotely? [Y/n] Y
... Success!
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
eload privilege tables now? [Y/n] Y
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...


できたーーーー(涙)
俺に何時間掛けさせるつもりやねん!

全部GrailsがデフォルトDB使えずにMySQLを設定しなければいけないせいだ!!

 

使える git コマンドまとめ

 関係ないファイルがgitで管理されてしまった場合、そのファイルを.gitignoreに追記し、以下のコマンドを実行する事でgit管理外となる。

$ git add .gitignore
$ git commit -m "Add ignore pattern"
$ git rm --cached `git ls-files --full-name -i --exclude-from=.gitignore`
$ git status
$ git commit -m "Remove ignore files"