Moodle 数据库过载错误

Moodle Database Overload Error

系统运行很好,但是突然出现这个错误'Database connection failed',可能是什么问题,我怎样才能永久修复这个错误。 谢谢你。

系统信息: Ubuntu 16.04.3 x64 2 GB 内存/50 GB 磁盘

I checked with 'df -h' in the terminal,

我做了错误日志检查:

2018-07-31T10:10:04.751870Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2018-07-31T10:10:34.438715Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2018-07-31T10:10:34.438807Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2018-07-31T10:10:34.613317Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-07-31T10:10:34.615293Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.23-0ubuntu0.16.04.1) starting as process 14674 ...
2018-07-31T10:10:34.620666Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-07-31T10:10:34.620694Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-07-31T10:10:34.620699Z 0 [Note] InnoDB: Uses event mutexes
2018-07-31T10:10:34.620703Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-07-31T10:10:34.620706Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-07-31T10:10:34.620710Z 0 [Note] InnoDB: Using Linux native AIO
2018-07-31T10:10:34.621008Z 0 [Note] InnoDB: Number of pools: 1
2018-07-31T10:10:34.621153Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-07-31T10:10:34.623069Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-07-31T10:10:34.634597Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-07-31T10:10:34.637277Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-07-31T10:10:34.647303Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2018-07-31T10:10:34.647393Z 0 [ERROR] InnoDB: redo log file './ib_logfile0' exists. Creating system tablespace with existing redo log files is not recommended. Please delete all redo log files before creating new system tablespace.
2018-07-31T10:10:34.647403Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
2018-07-31T10:10:35.248139Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-07-31T10:10:35.248186Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-07-31T10:10:35.248195Z 0 [ERROR] Failed to initialize builtin plugins.
2018-07-31T10:10:35.248201Z 0 [ERROR] Aborting

2018-07-31T10:10:35.248222Z 0 [Note] Binlog end
2018-07-31T10:10:35.248304Z 0 [Note] Shutting down plugin 'MyISAM'
2018-07-31T10:10:35.248323Z 0 [Note] Shutting down plugin 'CSV'
2018-07-31T10:10:35.248824Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

如果您告诉我们您的 moodle 是使用 LAMP、MAMP、WAMP、WIMP、XAMPP、远程托管...

此外,如果您检查错误日志,它应该包含有关该问题的更多信息。

我之前有同样的错误,数据库超载所以改变 max_execution_time 的值解决了这个错误。进入config.php搜索:

upload_max_filesize = 2M or the value yo need.

max_execution_time = 60 or the value you need, the value are seconds.

看到你的日志后,我搜索了你的错误,我希望这会起作用:

减小配置中innodb-buffer-pool size的值file/etc/mysql/my.cnf:

innodb_buffer_pool_size = 10M

保存my.cnf后,重启mysql服务。

来源Getting error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed" when starting MySQL

您是否在此过程中更改了 ib_logfile 大小?错误 The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created! 表明它找不到您的 ibdata 文件。您是否尝试了建议的 Please delete all redo log files before creating new system tablespace

按照以下步骤解决了错误:

InnoDB: Unable to lock ./ibdata1, error: 11

命令是:

# cd /var/lib/mysql
# mkdir bak
# mv ibdata1 bak/.
# mv ib_logfile* bak/.
# cp -a bak/ibdata1 ibdata1
# cp -a bak/ib_logfile* .
# service mysql restart

Read the source

然后我收到关于 'restarting mysql service'

的错误

find the error post here

然后执行以下步骤:

lsof -i:3306

Then kill it (the process number)

kill -9 PROCESS

e.g. kill -9 13498

Then try to restart MySQL again.

Read the Source

感谢@Evgeniy 和@Quiron。