Error: database connection failed
If you get errors like «database connection failed» or «could not connect to the database you specified», here are some possible reasons and some possible solutions.
- Your database server isn’t installed or running. To check this for MySQL try typing the following command line
$telnet database_host_name 3306
- You should get a cryptic response which includes the version number of the MySQL server.
- If you are attempting to run two instances of Moodle on different ports, use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.
- You don’t have the PHP mysql or postgresql extensions installed (please refer to FAQ re. whether PHP is installed).
- You haven’t created a Moodle database and assigned a user with the correct privileges to access it.
- The Moodle database settings are incorrect. The database name, database user or database user password in your Moodle configuration file config.php are incorrect. Use phpMyAdmin to set up and check your MySQL installation.
- Check that there are no apostrophes or non-alphabetic letters in your MySQL username or password.
- You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the default password hashing algorithm is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password'); mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');
- Also, consider upgrading your PHP MySQL extension. See this MySQL document for further information on how to deal with this problem.
- You are using Fedora core 3 or some other Linux system with SELinux installed and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don’t want to disable SELinux, you have to allow httpd process to create network connections:
setsebool httpd_can_network_connect true
- Mac OSX users—if you are running MySQL on a Mac OSX, try changing $CFG->dbhost from ‘localhost’ to ‘127.0.0.1’
See also: MySQL page on common errors which lists several possible scenarios for connection failure, with advice on how to fix the problems.
I can’t log in with message «Please verify that the current setting of session.save_path is correct»
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) failed: No space left on device (28) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (some-path/sessions) in Unknown on line 0
To temporarily bypass these errors, use database sessions by editing your moodle configuration file and adding this line:
$CFG->dbsessions = true;
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:
- Check access rights. The session.save_path should be accessible by the apache user. Try this command:
chown -R apache:apache some-path/sessions
- This assumes that ‘apache’ is the name of the user your webserver runs under — it could also be ‘nobody’.
- Check the permissions to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:
chmod -R 0777 some-path/sessions
- If this fixes the problem, reduce the permissions (700 is recommended).
See also: Session problems can be specific to your server environment. As an example, see this forum discussion about session problems with Lycos hosting.
Error: A server error that affects your login session was detected
If restarting your browser and logging in again to your Moodle site does not work, see the Using Moodle forum discussion about this error message.
If this was received at a Moodle.org site, the site could be in the process of updating. Please try the suggestion and/or wait and try it again. Or report it in Tracker.
Error: Failed opening required ‘/web/moodle/lib/setup.php’
In your config.php, the setting that you use for the dirroot variable must be the complete path from the root of your server’s hard drive.
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.
My pages show fatal errors such as : Parse error, call to undefined function: get_string()
If you see errors like:
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php on line 11
then you have probably left out a semi-colon or closing quote from a line in config.php (previous to line 94).
Another possibility is that you edited config.php in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad++.
Another thing to check, particularly if you are using additional plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:
short_open_tag = On
You should never find short tags in core moodle code. If you do, please file a bug in the tracker.
When I go to the admin page, I get told to make dirroot blank!
If you see errors like this:
Please fix your settings in config.php: You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; but it should be: $CFG->dirroot = "";
then you have encountered a small bug that occurs on some servers. The problem is with the error-checking mechanism, not with your actual path. To fix it, find this line (line 66) in the file admin/index.php:
if ($dirroot != $CFG->dirroot) {
and change it to this:
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
If you see errors like this:
Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1322
Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1323
Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php on line 54
you have blank lines or spaces after the final ?>
in your config.php file. Sometimes text editors add these — for example Notepad on Windows — so you may have to try a different text editor (e.g., Notepad++ to remove these spaces or blank lines completely.
Error: «500:Internal Server Error»
There are several possible causes for this error. It is a good idea to start by checking your web server error log which should have a more comprehensive explanation. However, here are some known possibilities….
1. Syntax error: There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written differs depending on which file you are using. You can test for configuration errors in your Apache files using the command:
#apachectl configtest
2. PHPsuexec: Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:
— you may also see a 403: Forbidden error.
— the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:
#chmod -R 755 moodle
— use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that for PHP4, PHP.INI files are per-directory, so you’ll need to copy it to each sub-directory. If you are using PHP5 or higher on a shared host, check with your host on whether they support custom PHP.INI files, and how to create them. The syntax used in a PHP.INI file is different from a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.
php_value memory_limit 128M <-- .htaccess memory_limit = 128M <-- php.ini equivalent
3. Incompatible directive: You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.
Error «403: Forbidden»
Check your webserver configuration. See also the section above «500:Internal Server Error».
Fatal error allowed memory size exhausted. How do I increase my php memory limit?
You will sometimes see an error message something like this:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate xx bytes) in /var/www/moodle/yyyy.php
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the «allowed memory size» — 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.
- On a hosted installation you should ask your host’s support how to do this. However, many allow .htaccess files. If yours does, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):
php_value memory_limit <value>M Example: php_value memory_limit 40M
- If you have your own server with shell access, edit your php.ini file (make sure it’s the correct one by checking in your phpinfo output) as follows:
memory_limit <value>M Example: memory_limit 40M
- For later versions of Moodle you could be looking at figures in the region of 512M for all functions to work properly (backup and restore are particularly memory hungry). It is sensible to monitor the memory usage on your server if using these large settings.
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command memory_limit 0.
Error: «Your session has timed out. Please login again.» or «The page isn’t redirecting properly» or «This webpage has a redirect loop»
Please do one/all of the following:
- Try deleting cookies manually from your browser and close it down, then access your site again. Sometimes this clears up the problem.
- Check that your moodledata/sessions directory has write permissions. When you access Moodle a new file should be created there.
- If you are running two versions of Moodle on the same computer, set a cookie prefix in Administration > Server > Session handling.
The discussion Your session has timed out. Please login again has further suggested solutions:
- Browse to: http://yoursite/subdir/admin/purgecaches.php , it should prompt you to login first and then redirect to a page that has a button to purge all caches.
- If you can access your server files, go to the ‘moodledata’ folder, go to the ‘cache’ folder inside and erase all the contents there (usually only two files). Moodle will delete the frozen session with the redirect loop and Moodle will work again.
Error when installing: ERR_TOO_MANY_REDIRECTS
- You will need to edit the moodleadminindex.php file with a file editor such as Notepad++. Do not use MS-Word!
- Search for a line that has:
redirect("index.php?sessionstarted=1&lang=$CFG->lang");
- and add two inverted slashes to comment it out like this:
//redirect("index.php?sessionstarted=1&lang=$CFG->lang");
- and try to continue with the installation from your browser.
Fatal error: Maximum execution time of 30 seconds exceeded in…(when installing)
- Your computer is taking too much time to execute the installation scripts. The default value used to be 30 seconds (but some new Moodle branches have increased it).
- Press F5 (refresh) until it finishes the installation process.
- Or, edit the file at your_local_serverserverphpphp.ini using a text editor such as Notepad++. Do not use MS-Word!
- Look for a line that has:
max_execution_time = 30
-
- And substituthe the 30 seconds value for a much longer time; e.g., 600, so that it looks like:
max_execution_time = 600
-
- Save the edited file and restart the local server installation
Error when installing: The connection was reset/This site can’t be reached
Did you install or upgrade Skype ?
- Skype uses the same port (80) as Moodle.
- Remove Skype.
- Restart Windows.
- Install Moodle and
- Re-install Skype.
Check the PC with a good antivirus
- Be very cautious when choosing a free/paid Windows antivirus.
- Good places to look for are old, reliable, solid PC magazines and old, reliable, solid PC blogs.
- Beware of many malicious malware programs posing as antivirus solutions!
- It may be worth asking your local IT expert, or Google for any chosen solution, before installing it.
Increase the time allowed for running scripts in Moodle
- Click ‘Stop Moodle.exe’
- Edit (use Notepad++ or other simple text editor; do NOT use MS-Word) the file server/php/php.ini and increase the number in the line that states max_execution_time = :
- Increase the value to, let’s say, 10 minutes (600 seconds):
- Click ‘Start Moodle.exe’
- Check if the problem was solved; if not, continue reading below.
Check if you need to increase Apache’s default stack size
- This problem has been described in Windows 7 PCs and laptops with Moodle 3.4, 3.5 and 3.6 Moodle for Windows complete install packages.
- If you check the error.log file at server/apache/logs/error.log and you find a line with
child process XXXX exited with status 3221226356 -- Restarting.
-
- (where XXXX is a number, any number)
- you may have a problem that often happens in Windows because of smaller Apache’s default stack size. And it usually happens when working with php code that allocates a lot of stacks.
- To solve this issue, use a text editor (such as Notepad++, DO NOT USE MS-WORD) to add the following three lines at the end of apache config file (../server/apache/conf/httpd.conf) :
<IfModule mpm_winnt_module> ThreadStackSize 8888888 </IfModule>
- AND restart apache.
Do you have Google Drive?
- Heap corruption (STATUS_HEAP_CORRUPTION). Some programs like Google Drive may be causing heap corruption.
- Switching to the latest version of Apache (XAMPP) may fix the issue.
Are you using XAMPP?
Go to XAMPP-Cotroll and open Apache->Config->httpd.conf and add
<IfModule mpm_winnt_module> ThreadStackSize 8888888 </IfModule>
to the end
See https://moodle.org/mod/forum/discuss.php?d=38758
How can I fix just one bug, without upgrading my whole site?
Suppose:
- You are running an older Moodle version.
- You are experiencing a particular bug.
- You have searched in the tracker, and found that your problem is MDL-abc, and that it has been fixed in the latest version.
- For some reason, you cannot upgrade your whole site, even though the latest version probably has security fixes.
Then, how can you get the fix for just this one bug, without upgrading your whole site? Well, if you are prepared to manually patch the code, you can probably get this information from the tracker. Please see this guide.
Error: ‘undefined’ message
This may be related to the langconfig.php setting for ‘locale’ in your language pack. Please contact your language pack maintainer.
See also
- Category:Error for a list of Moodle error pages.
Receiving an error ‘Moodle error database connection failed’ while installing moodle? We can help you fix it.
This error normally occurs due to various reasons which include database server down, PHP installation, improper settings in the configuration file and many more.
At Bobcares, we receive requests on fixing moodle errors as a part of our Server Management Services.
Today, let’s know the different reasons for this moodle database error to occur and see how our Support Engineers fix it.
Why moodle fails to connect to the database?
We have many customers who use moodle. And few of them have come across this error message while installing the moodle.
However, there are many different reasons for this error to occur.
This includes the database server to be not working, missing PHP, error in the database settings in the config.php file.
Also, if the MySQL version is incompatible with the PHP version then this error will occur.
Here is a screenshot of the error message that appears in the moodle.
Now, let’s see how our Support Engineers fix this error
How we fix moodle error database connection failed?
Recently, one of our customers approached us with the below moodle error:
Error: Database connection failed
Our Support Engineers started troubleshooting this error by checking the database in the account.
We checked the MySQL availability using the command :
$telnet database_host_name 3306
As a result, we got to know that MySQL is up and working well.
We then checked the database settings which is set in the configuration file config.php using the commands
cd /var/www/html/moodle
vi config.php
We could find that the database set in the file was having a spelling mistake in it. So we set it with the right one.
And finally, this fixed the error.
[Need further assistance with moodle errors? – We’ll help you]
Conclusion
In short, the moodle error database connection failed is caused due to many reasons which include database server down, PHP installation, improper settings in the configuration file and many more. Today, we saw how our Support Engineers fix this error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
Moodle in Russian — сообщество русскоязычных пользователей Moodle
Технические вопросы
Ошибка подключения к БД
Ошибка подключения к БД
При установке, ввожу в параметрах порт базы данных 80 к примеру. После этого происходит ошибка подключения к БД. Если порт не вводить, то установка продолжается, но после копирования файлов — происходит «ошибка во время связи с сервером». Подскажите что я делаю не так. Спасибо )
Re: Ошибка подключения к БД
У вас сервер MySQL вообще «падает», ищите причину, Логи смотрите.
Re: Ошибка подключения к БД
Re: Ошибка подключения к БД
Так на порту 80 висит доступ к веб-серверу. Для mysql порт по-умолчанию это 3306. Если не указываете порт. то цепляется к 3306 и все работает. Если хотите именно 80, то перенастраиваете mysql на 80 порт, а веб-сервер на какой-то другой, чтобы они не конфликтовали.
Re: Ошибка подключения к БД
Вот вы говорите что цепляется к 3306 и все работает. Возможно он и цепляется к 3306 т.к. я (повторюсь) писал что я пробовал оставлять поле пустым и что после этого другая ошибка (после установки) возникала.
Re: Ошибка подключения к БД
Кто и как устанавливал mysql? На какой порт? От имени какой учетки и с какими правами пытались цепляться к mysql при установке moodle? Или, судя по полному пути, что на скриншоте у вас сначала поставлен wordpress, а потом, в эту же базу хотите установить таблицы от moodle? — смотрите в mysql — настройки и права пользователей — кто и что имеет право делать.
Re: Ошибка подключения к БД
MySQL у меня через OpenServer. От имени своей учётки с полными правами для отдельно созданной базы данных moodle. К ВордПресс она никакого отношения не имеет. Это просто расположение файлов.
Re: Ошибка подключения к БД
В OpenServer есть свои настройки портов для всех программ, поэтому при установке Мудл поле нужно оставлять пустым. И, тем более не нужно указывать порт 80, так как этот порт используется для Апач, как верно подметил Евгений.
А если «пробовал оставлять поле пустым и что после этого другая ошибка (после установки) возникала», то нужно смотреть логи, чтобы узнать, что за ошибка. Тут Кашпировских нет, лечить на расстоянии не получится.
Источник
Moodle in Russian — сообщество русскоязычных пользователей Moodle
Общий форум
Ошибка подключения к базе данных при установке moodle
Ошибка подключения к базе данных при установке moodle
Час добрый! Сразу хочу отметить, что обсуждения в данную тему читал на этом форуме и других местах, искал решение и так и не нашел, поэтому вынужден обратиться за помощью.
Возникла необходимость поднять moodle на базе debian 10.
Сейчас, на этапе инсталляции возникает эта пресловутая ошибка:
» Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php»
1) содержимое config.php:
2) Пользователь alex имеет неограниченные права, в phpmyadmin проверено
3) содержимое файла mysql.cnf:
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda
В чем может быть проблема?
Re: Ошибка подключения к базе данных при установке moodle
$CFG->dbhost = ‘127.0.0.1:8081’ — Это что ещё за фантазии?
Тут должен быть адрес, по которому нужно обращаться к серверу БД. Во всех случаях это localhost и, обычно, без указания порта, если вы не хотите изменить порт по умолчанию. Тогда порт нужно прописывать отдельно, например:
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Да я и вручную создавал и через phpmyadmin. И права пользователю давал.
по запросу
systemctl status mariadb
выдает:
ariadb.service — MariaDB 10.3.18 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset:
Active: active (running) since Sun 2019-12-15 15:29:12 +07; 7h ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 21545 (mysqld)
Status: «Taking your SQL requests now. »
Tasks: 32 (limit: 4915)
Memory: 79.9M
CGroup: /system.slice/mariadb.service
└─21545 /usr/sbin/mysqld
дек 15 15:45:49 Moddle mysqld[21545]: 2019-12-15 15:45:49 76 [Warning] Access de
дек 15 15:45:58 Moddle mysqld[21545]: 2019-12-15 15:45:58 79 [Warning] Access de
дек 15 15:46:10 Moddle mysqld[21545]: 2019-12-15 15:46:10 82 [Warning] Access de
дек 15 15:46:15 Moddle mysqld[21545]: 2019-12-15 15:46:15 85 [Warning] Access de
дек 15 15:46:29 Moddle mysqld[21545]: 2019-12-15 15:46:29 88 [Warning] Access de
дек 15 16:10:25 Moddle mysqld[21545]: 2019-12-15 16:10:25 91 [Warning] Access de
дек 15 16:13:46 Moddle mysqld[21545]: 2019-12-15 16:13:46 94 [Warning] Access de
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 97 [Warning] IP addres
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 98 [Warning] IP addres
дек 15 19:10:32 Moddle mysqld[21545]: 2019-12-15 19:10:32 102 [Warning] Access
Источник
Moodle in Russian — сообщество русскоязычных пользователей Moodle
Общий форум
Ошибка подключения к базе данных при установке moodle
Ошибка подключения к базе данных при установке moodle
Час добрый! Сразу хочу отметить, что обсуждения в данную тему читал на этом форуме и других местах, искал решение и так и не нашел, поэтому вынужден обратиться за помощью.
Возникла необходимость поднять moodle на базе debian 10.
Сейчас, на этапе инсталляции возникает эта пресловутая ошибка:
» Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php»
1) содержимое config.php:
2) Пользователь alex имеет неограниченные права, в phpmyadmin проверено
3) содержимое файла mysql.cnf:
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda
В чем может быть проблема?
Re: Ошибка подключения к базе данных при установке moodle
$CFG->dbhost = ‘127.0.0.1:8081’ — Это что ещё за фантазии?
Тут должен быть адрес, по которому нужно обращаться к серверу БД. Во всех случаях это localhost и, обычно, без указания порта, если вы не хотите изменить порт по умолчанию. Тогда порт нужно прописывать отдельно, например:
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Да я и вручную создавал и через phpmyadmin. И права пользователю давал.
по запросу
systemctl status mariadb
выдает:
ariadb.service — MariaDB 10.3.18 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset:
Active: active (running) since Sun 2019-12-15 15:29:12 +07; 7h ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 21545 (mysqld)
Status: «Taking your SQL requests now. »
Tasks: 32 (limit: 4915)
Memory: 79.9M
CGroup: /system.slice/mariadb.service
└─21545 /usr/sbin/mysqld
дек 15 15:45:49 Moddle mysqld[21545]: 2019-12-15 15:45:49 76 [Warning] Access de
дек 15 15:45:58 Moddle mysqld[21545]: 2019-12-15 15:45:58 79 [Warning] Access de
дек 15 15:46:10 Moddle mysqld[21545]: 2019-12-15 15:46:10 82 [Warning] Access de
дек 15 15:46:15 Moddle mysqld[21545]: 2019-12-15 15:46:15 85 [Warning] Access de
дек 15 15:46:29 Moddle mysqld[21545]: 2019-12-15 15:46:29 88 [Warning] Access de
дек 15 16:10:25 Moddle mysqld[21545]: 2019-12-15 16:10:25 91 [Warning] Access de
дек 15 16:13:46 Moddle mysqld[21545]: 2019-12-15 16:13:46 94 [Warning] Access de
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 97 [Warning] IP addres
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 98 [Warning] IP addres
дек 15 19:10:32 Moddle mysqld[21545]: 2019-12-15 19:10:32 102 [Warning] Access
Источник
Moodle in Russian — сообщество русскоязычных пользователей Moodle
Общий форум
Ошибка подключения к базе данных при установке moodle
Ошибка подключения к базе данных при установке moodle
Час добрый! Сразу хочу отметить, что обсуждения в данную тему читал на этом форуме и других местах, искал решение и так и не нашел, поэтому вынужден обратиться за помощью.
Возникла необходимость поднять moodle на базе debian 10.
Сейчас, на этапе инсталляции возникает эта пресловутая ошибка:
» Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php»
1) содержимое config.php:
2) Пользователь alex имеет неограниченные права, в phpmyadmin проверено
3) содержимое файла mysql.cnf:
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda
В чем может быть проблема?
Re: Ошибка подключения к базе данных при установке moodle
$CFG->dbhost = ‘127.0.0.1:8081’ — Это что ещё за фантазии?
Тут должен быть адрес, по которому нужно обращаться к серверу БД. Во всех случаях это localhost и, обычно, без указания порта, если вы не хотите изменить порт по умолчанию. Тогда порт нужно прописывать отдельно, например:
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Да я и вручную создавал и через phpmyadmin. И права пользователю давал.
по запросу
systemctl status mariadb
выдает:
ariadb.service — MariaDB 10.3.18 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset:
Active: active (running) since Sun 2019-12-15 15:29:12 +07; 7h ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 21545 (mysqld)
Status: «Taking your SQL requests now. »
Tasks: 32 (limit: 4915)
Memory: 79.9M
CGroup: /system.slice/mariadb.service
└─21545 /usr/sbin/mysqld
дек 15 15:45:49 Moddle mysqld[21545]: 2019-12-15 15:45:49 76 [Warning] Access de
дек 15 15:45:58 Moddle mysqld[21545]: 2019-12-15 15:45:58 79 [Warning] Access de
дек 15 15:46:10 Moddle mysqld[21545]: 2019-12-15 15:46:10 82 [Warning] Access de
дек 15 15:46:15 Moddle mysqld[21545]: 2019-12-15 15:46:15 85 [Warning] Access de
дек 15 15:46:29 Moddle mysqld[21545]: 2019-12-15 15:46:29 88 [Warning] Access de
дек 15 16:10:25 Moddle mysqld[21545]: 2019-12-15 16:10:25 91 [Warning] Access de
дек 15 16:13:46 Moddle mysqld[21545]: 2019-12-15 16:13:46 94 [Warning] Access de
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 97 [Warning] IP addres
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 98 [Warning] IP addres
дек 15 19:10:32 Moddle mysqld[21545]: 2019-12-15 19:10:32 102 [Warning] Access
Источник
Moodle in Russian — сообщество русскоязычных пользователей Moodle
Общий форум
Ошибка подключения к базе данных при установке moodle
Ошибка подключения к базе данных при установке moodle
Час добрый! Сразу хочу отметить, что обсуждения в данную тему читал на этом форуме и других местах, искал решение и так и не нашел, поэтому вынужден обратиться за помощью.
Возникла необходимость поднять moodle на базе debian 10.
Сейчас, на этапе инсталляции возникает эта пресловутая ошибка:
» Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php»
1) содержимое config.php:
2) Пользователь alex имеет неограниченные права, в phpmyadmin проверено
3) содержимое файла mysql.cnf:
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda
В чем может быть проблема?
Re: Ошибка подключения к базе данных при установке moodle
$CFG->dbhost = ‘127.0.0.1:8081’ — Это что ещё за фантазии?
Тут должен быть адрес, по которому нужно обращаться к серверу БД. Во всех случаях это localhost и, обычно, без указания порта, если вы не хотите изменить порт по умолчанию. Тогда порт нужно прописывать отдельно, например:
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Re: Ошибка подключения к базе данных при установке moodle
Да я и вручную создавал и через phpmyadmin. И права пользователю давал.
по запросу
systemctl status mariadb
выдает:
ariadb.service — MariaDB 10.3.18 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset:
Active: active (running) since Sun 2019-12-15 15:29:12 +07; 7h ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 21545 (mysqld)
Status: «Taking your SQL requests now. »
Tasks: 32 (limit: 4915)
Memory: 79.9M
CGroup: /system.slice/mariadb.service
└─21545 /usr/sbin/mysqld
дек 15 15:45:49 Moddle mysqld[21545]: 2019-12-15 15:45:49 76 [Warning] Access de
дек 15 15:45:58 Moddle mysqld[21545]: 2019-12-15 15:45:58 79 [Warning] Access de
дек 15 15:46:10 Moddle mysqld[21545]: 2019-12-15 15:46:10 82 [Warning] Access de
дек 15 15:46:15 Moddle mysqld[21545]: 2019-12-15 15:46:15 85 [Warning] Access de
дек 15 15:46:29 Moddle mysqld[21545]: 2019-12-15 15:46:29 88 [Warning] Access de
дек 15 16:10:25 Moddle mysqld[21545]: 2019-12-15 16:10:25 91 [Warning] Access de
дек 15 16:13:46 Moddle mysqld[21545]: 2019-12-15 16:13:46 94 [Warning] Access de
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 97 [Warning] IP addres
дек 15 19:00:00 Moddle mysqld[21545]: 2019-12-15 19:00:00 98 [Warning] IP addres
дек 15 19:10:32 Moddle mysqld[21545]: 2019-12-15 19:10:32 102 [Warning] Access
Источник
5 Replies
-
has mysql shutdown due to the disk space issue?
/etc/init.d/mysql start
Was this post helpful?
thumb_up
thumb_down
-
Gary,
I tried that I get:
start: Rejected send message, 1 matched rules; type=»method_call», sender=»:1.6″ (uid=1000 pid=1444 comm=»start mysql «) interface=»com.ubuntu.Upstart0_6.Job» member=»Start» error name=»(unset)» requested_reply=»0″ destination=»com.ubuntu.Upstart» (uid=0 pid=1 comm=»/sbin/init»)
Was this post helpful?
thumb_up
thumb_down
-
I tried service mysql start. I receive the message «Job Failed to start»
Was this post helpful?
thumb_up
thumb_down
-
I deleted files. The server disk was full. It is working now.
Was this post helpful?
thumb_up
thumb_down
-
I deleted files. The server disk was full. It is working now.
What? Seriously? What happened to the space you added?
Was this post helpful?
thumb_up
thumb_down
After cloning moodle in /tmp/moodle directory I try to follow the proposed way to do some tests:
And I run it on CEntOS-8 with the versions mentioned
export PATH=$PATH:~/dev/moodle-docker-compose/bin
export MOODLE_DOCKER_DB=pgsql
export MOODLE_DOCKER_WWWROOT=/tmp/moodle/
cp ~/dev/moodle-docker-compose/config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php
moodle-docker-compose up -d
moodle-docker-wait-for-db
Show docker containers and their IP addresses
docker ps -q | xargs -n 1 docker inspect —format ‘{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} {{ .Name }}’ | sed ‘s/ // /’
Initialize Moodle database for manual testing
moodle-docker-compose exec webserver php admin/cli/install_database.php —agree-license —fullname=»Docker moodle» —shortname=»docker_moodle» —adminpass=»test» —adminemail=»admin@example.com»
Initialize behat environment
moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php
[..]
Run behat tests
moodle-docker-compose exec -u www-data webserver php admin/tool/behat/cli/run.php —tags=@auth_manual
Initialize phpunit environment
moodle-docker-compose exec webserver php admin/tool/phpunit/cli/init.php
[..]
Run phpunit tests
moodle-docker-compose exec webserver vendor/bin/phpunit auth_manual_testcase auth/manual/tests/manual_test.php
moodle-docker-compose down
And this is what I get:
moodle-docker-compose_db_1 is up-to-date
Starting moodle-docker-compose_selenium_1 …
moodle-docker-compose_mailhog_1 is up-to-date
moodle-docker-compose_exttests_1 is up-to-date
Starting moodle-docker-compose_selenium_1 … done
172.30.0.6 moodle-docker-compose_webserver_1
172.30.0.3 moodle-docker-compose_db_1
172.30.0.5 moodle-docker-compose_mailhog_1
172.30.0.4 moodle-docker-compose_exttests_1
!!!
Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php
!!!
Debug info:
Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No route to host
Is the server running on host «db» (172.30.0.3) and accepting
TCP/IP connections on port 5432? in [dirroot]/lib/dml/pgsql_native_moodle_database.php on line 176
Error code: dbconnectionfailed
Stack trace: * line 187 of /lib/dml/pgsql_native_moodle_database.php: dml_connection_exception thrown
- line 340 of /lib/dmllib.php: call to pgsql_native_moodle_database->connect()
- line 619 of /lib/setup.php: call to setup_DB()
- line 96 of /config.php: call to require_once()
- line 78 of /admin/cli/install_database.php: call to require()
PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No route to host
Is the server running on host «db» (172.30.0.3) and accepting
TCP/IP connections on port 5432? in /var/www/html/lib/dml/pgsql_native_moodle_database.php on line 176
!!!Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php
!!!
Debug info:
Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No route to host
Is the server running on host «db» (172.30.0.3) and accepting
TCP/IP connections on port 5432? in [dirroot]/lib/dml/pgsql_native_moodle_database.php on line 176
Error code: dbconnectionfailed
Stack trace: * line 187 of /lib/dml/pgsql_native_moodle_database.php: dml_connection_exception thrown
- line 340 of /lib/dmllib.php: call to pgsql_native_moodle_database->connect()
- line 619 of /lib/setup.php: call to setup_DB()
- line 119 of /admin/tool/behat/cli/util_single_run.php: call to require()
Running single behat site:
Could not open input file: /var/www/html/vendor/bin/behat
To re-run failed processes, you can use following command:
php admin/tool/behat/cli/run.php —tags=»@auth_manual» —rerun
Initialising Moodle PHPUnit test environment…
Can not find PHPUnit library, to install use: php composer.phar install
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused «exec: «vendor/bin/phpunit»: stat vendor/bin/phpunit: no such file or directory»: unknown
- Index
- » Networking, Server, and Protection
- » Moodle doesn’t work after upgrading to MySQL 5.1.41 [Solved]
Pages: 1
#1 2009-11-19 16:24:07
- Ravenman
- Member
- Registered: 2009-07-03
- Posts: 236
Moodle doesn’t work after upgrading to MySQL 5.1.41 [Solved]
Hi to everyone:
I did upgrade to MySQL 5.1.41-2 and Moodle doesn’t work now
When I’m trying access to http://http://localhost/moodle/, the system shows me this message:
Error: Database connection failed.
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php
I’m testing the database connection (by console) and everything works fine.
Someone else with the same problem … anyone knows how to fix it?
Last edited by Ravenman (2009-11-19 16:54:34)
#2 2009-11-19 16:35:38
- louipc
- Member
- Registered: 2006-10-09
- Posts: 85
Re: Moodle doesn’t work after upgrading to MySQL 5.1.41 [Solved]
Somewhere in the moodle config or code there may be a line that has «/tmp/mysql.sock»
You would have to change that to «/var/run/mysqld/mysqld.sock».
Or possibly in php.ini:
mysql.default_socket = /var/run/mysqld/mysqld.sock
Cheers.
#3 2009-11-19 16:54:09
- Ravenman
- Member
- Registered: 2009-07-03
- Posts: 236
Re: Moodle doesn’t work after upgrading to MySQL 5.1.41 [Solved]
louipc wrote:
Somewhere in the moodle config or code there may be a line that has «/tmp/mysql.sock»
You would have to change that to «/var/run/mysqld/mysqld.sock».Or possibly in php.ini:
mysql.default_socket = /var/run/mysqld/mysqld.sockCheers.
Yes, you made it!. I’ve changed the mysql.default_socket value in my /etc/php/php.ini and everything is fine now.
Thanks for your help, Louipc. Until the next!