MySQL on FreeBSD

CONTENTS


Lastmodified 2019-05-25 (土) 11:01:26


MySQL が起動しない

mysql56 を portupgrade したら起動しなくなった

portのバージョンが更新されたので、

portupgrade

したら、起動しなくなった。/var/db/mysql/FQDN.err は、

2017-01-21 08:19:26 29191 [Warning] Buffered warning: Could not increase number of max_open_files to more than 32768 (request: 32929) 

2017-01-21 08:19:26 29191 [Warning] Buffered warning: Changed limits: table_open_cache: 16303 (requested 16384)

2017-01-21 08:19:26 29191 [Note] Plugin 'FEDERATED' is disabled.
2017-01-21 08:19:26 29191 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-01-21 08:19:26 29191 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-21 08:19:26 29191 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-21 08:19:26 29191 [Note] InnoDB: Memory barrier is not used
2017-01-21 08:19:26 29191 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-21 08:19:26 29191 [Note] InnoDB: Not using CPU crc32 instructions
2017-01-21 08:19:26 29191 [Note] InnoDB: Initializing buffer pool, size = 1.0G
2017-01-21 08:19:26 29191 [Note] InnoDB: Completed initialization of buffer pool
2017-01-21 08:19:26 29191 [ERROR] InnoDB: auto-extending data file /var/db/mysql/ibdata1 is of a different size 4864 pages
(rounded down to MB) than specified in the .cnf file: initial 8192 pages, max 0 (relevant if non-zero) pages!
2017-01-21 08:19:26 29191 [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!
2017-01-21 08:19:26 29191 [ERROR] Plugin 'InnoDB' init function returned error.
2017-01-21 08:19:26 29191 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-01-21 08:19:26 29191 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-01-21 08:19:26 29191 [ERROR] Aborting

2017-01-21 08:19:26 29191 [Note] Binlog end
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'partition'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_METRICS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_CMPMEM'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_CMP'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_LOCKS'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'INNODB_TRX'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'BLACKHOLE'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'ARCHIVE'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'MRG_MYISAM'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'MyISAM'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'MEMORY'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'CSV'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'sha256_password'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'mysql_old_password'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'mysql_native_password'
2017-01-21 08:19:26 29191 [Note] Shutting down plugin 'binlog'
2017-01-21 08:19:26 29191 [Note] /usr/local/libexec/mysqld: Shutdown complete

 【解決方法】

/etc/rc.conf

mysql_enable="YES"
mysql_optfile="/usr/local/etc/mysql/my.cnf"

と、今時のmy.cnfの位置を指定したうえで、

/usr/local/etc/mysql/my.cnf

#innodb_data_file_path           = ibdata1:128M:autoextend

の行をコメントアウトしたら、起動した。

早速、

# mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
mysqlcheck: Got error: 1049: Unknown database 'jm3' when selecting the database
FATAL ERROR: Error during call to mysql_check for fixing the db/tables names on all db(s) except mysql

ありゃ?

FATAL ERROR: Error during call to mysql_check for fixing the db/tables names on all db(s) except mysql

 解決策

/usr/local/etc/mysql/my.cnf

#lower_case_table_names          = 1
lower_case_table_names          = 0       ←これを1から0へ変更

https://dev.mysql.com/doc/refman/5.6/ja/identifier-case-sensitivity.html

これで、

# mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
              :                :
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
JM3.vg49r_assets                                   OK
JM3.vg49r_associations                             OK
JM3.vg49r_banner_clients                           OK
                 :                    : 
phpmyadmin.pma__userconfig                         OK
phpmyadmin.pma__usergroups                         OK
phpmyadmin.pma__users                              OK
OK

と、OKになった。

# mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
This installation of MySQL is already upgraded to 5.6.35, use --force if you still need to run mysql_upgrade

エラーが出ていたときは、

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.35-log Source distribution

Copyright (c) 2000, 2016, 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.

root@localhost [(none)]> show variables like 'lower%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | OFF   |
| lower_case_table_names | 1     |
+------------------------+-------+
2 rows in set (0.00 sec)

となっていた。

/usr/ports/UPDATING

20170120:

 AFFECTS: users of databases/mysql56-server
 AUTHOR: feld@FreeBSD.org

 databases/mysql56-server was updated to 5.6.35 which included backported
 rc script changes from the mysql57-server port. This broke mysql_optfile in
 rc.conf and also forced a sample my.cnf if none existed. MySQL has
 some parameters which cannot be changed after a database has been
 created, so this caused MySQL to fail to start.

 This change was reverted in mysql56-server-5.6.35_1

Total access 3525:本日 1:昨日 1

Counter: 3525, today: 1, yesterday: 1

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS