CONTENTS


Lastmodified 2019-02-08 (金) 13:41:06


Mysql dump & import

データベースのダンプ(バックアップ)

MySQL内の全データをファイルdump.sql(名前は自由)に出力。

mysqldump -u root -p -x --all-databases > dump.sql

特定のデータベース(database_name)のみバックアップする。

mysqldump -u root -p database_name > dump.sql

もしデータベースが文字化けしていた場合はこちら。

mysqldump --default-character-set=utf8 -u root -p database_name > dump.sql

更に特定データベースの特定テーブル(table_name1 table_name2)のみバックアップする場合はこちら。

mysqldump --default-character-set=utf8 -u root -p database_name table_name1 table_name2 > dump.sql

データベースのインポート(復元)

バックアップしたファイルをMySQLに取り込む。

mysql -u root -p < dump.sql

k222# mysqldump -u root -p EUSM > EUSM_back.sql
Enter password:
k222# scp EUSM_back.sql g7.kuji-clinic.net:/usr/home/mysql/

root@g7:/usr/home/mysql # mysql -u root -p < EUSM_back.sql
Enter password:
ERROR 1046 (3D000) at line 22: No database selected

特定のデータベースのダンプファイルをリストアする場合には、まず、指定のデータベースを作成してから、

# mysql -u user -p  db_name < dumpfile.sql

だそうです。(^^ゞ

root@g7:/usr/home/mysql # mysql -u root -p EUSM < EUSM.sql
Enter password:

5.1で作られたDBなので、データベースをアップデートする

http://server-setting.info/freebsd/freebsd_mysql_update.html

$ mysqlcheck --check-upgrade --all-databases --auto-repair --user=root --password
EUSM.activity_data                                 OK
EUSM.activity_image                                OK
EUSM.admin_user                                    OK
EUSM.album                                         OK
EUSM.album_image                                   OK
EUSM.application                                   OK
EUSM.application_invite                            OK
EUSM.application_lifecycle_event_queue             OK
EUSM.application_persistent_data                   OK
EUSM.application_translation                       OK
EUSM.ashiato                                       OK
EUSM.banner                                        OK
EUSM.banner_image                                  OK
EUSM.banner_translation                            OK
EUSM.banner_use_image                              OK
EUSM.blacklist                                     OK
EUSM.blog_rss_cache                                OK
EUSM.community                                     OK

なんか、問題ないっぽい(^^ゞ

SNSの引っ越し

引っ越し元のOpenPNEは、3.7.0-dev。ファイルは.tar.gz形式なので、

root@g7:/home # tar xvfz OpenPNE3_3.7.0-dev.tar.gz すると /home/OpenPNE3/ になるので、 root@g7:/home # mv OpenPNE3 EUSM して、 root@g7:/home/EUSM # ./symfony openpne:install

Warning: require(/usr/local/www/apache22/data/OpenPNE3/lib/task/opBaseSendMailTask.class.php): failed to open stream: No such file or directory in /usr/home/EUSM/lib/vendor/symfony/lib/autoload/sfSimpleAutoload.class.php on line 123

Fatal error: require(): Failed opening required '/usr/local/www/apache22/data/OpenPNE3/lib/task/opBaseSendMailTask.class.php' in /usr/home/EUSM/lib/vendor/symfony/lib/autoload/sfSimpleAutoload.class.php on line 123 %% root@g7:/home/EUSM #

あれ?どっかで見た様な・・・・(・・)

方針変更。素の3.7.0-devがみつからないので、3.6.10にDBをいれてみる。

root@g7:/home # unzip openpne-OpenPNE3-OpenPNE-3.6.10-0-g92aba62.zip
mv openpne-OpenPNE3-92aba62 EUSM

MySQLが起動しない

あいかわらずEUSMのDB周りでエラーがでてインストールが完了しない。それどころかMySQLも再起動しなくなった。

/usr/home/mysql/g7.kuji-clinic.net.err

d 130619 06:06:51 mysqld_safe Starting mysqld daemon with databases from /home/mysql

2013-06-19 06:06:51 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
                                Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-06-19 06:06:51 84858 [Note] Plugin 'FEDERATED' is disabled.
2013-06-19 06:06:51 84858 [Note] InnoDB: The InnoDB memory heap is disabled
2013-06-19 06:06:51 84858 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-06-19 06:06:51 84858 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-06-19 06:06:51 84858 [Note] InnoDB: Using CPU crc32 instructions
2013-06-19 06:06:51 84858 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-06-19 06:06:51 84858 [Note] InnoDB: Completed initialization of buffer pool
2013-06-19 06:06:51 84858 [Note] InnoDB: Highest supported file format is Barracuda.
2013-06-19 06:06:51 84858 [Note] InnoDB: 128 rollback segment(s) are active.
2013-06-19 06:06:51 84858 [Note] InnoDB: Waiting for purge to start
InnoDB: Error: tablespace id is 2211 in the data dictionary
InnoDB: but in file ./EUSM/community_category.ibd it is 2658!
2013-06-19 06:06:51 80280c800  InnoDB: Assertion failure in thread 34401732608 in file fil0fil.cc line 794
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.
21:06:51 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.

key_buffer_size=268435456
read_buffer_size=16777216
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 5212106 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
130619 06:06:51 mysqld_safe mysqld from pid file /home/mysql/g7.kuji-clinic.net.pid ended

というエラー。

http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html の仰せに従って、

/usr/local/etc/my.conf に

# Uncomment the following if you are using InnoDB tables
#############################################################
innodb_force_recovery = 4
#############################################################
#innodb_data_home_dir = /var/db/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/db/mysql

を書き込んで、再起動。

MySQL インストール直後

root@g7:/usr/home/db/mysql # ll
total 110537
-rw-rw----  1 mysql  mysql        56 Jun 20 15:19 auto.cnf
-rw-r-----  1 mysql  mysql      1792 Jun 20 15:19 g7.kuji-clinic.net.err
-rw-rw----  1 mysql  mysql         5 Jun 20 15:19 g7.kuji-clinic.net.pid
-rw-rw----  1 mysql  mysql  50331648 Jun 20 15:20 ib_logfile0
-rw-rw----  1 mysql  mysql  50331648 Jun 20 15:19 ib_logfile1
-rw-rw----  1 mysql  mysql  12582912 Jun 20 15:20 ibdata1
drwx------  2 mysql  mysql        81 Jun 20 15:19 mysql/
drwx------  2 mysql  mysql        55 Jun 20 15:19 performance_schema/
drwx------  2 mysql  mysql         2 Jun 20 15:19 test/

http://d.hatena.ne.jp/hiroi10/20121104/1352037845

2013-06-20 16:06:52 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

Total access 5155:本日 1:昨日 0

Counter: 5155, today: 1, yesterday: 0

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