phpMyAdmin: HTTP 403 (Forbidden); В конфигурационном файле необходимо задать парольную фразу (blowfish_secret); The configuration file now needs a secret passphrase (blowfish_secret).
Разбор всевозможных ошибок РНР и способов их решения.
- phpMyAdmin HTTP 403 (Forbidden)
- phpMyAdmin blowfish_secret
- 1. Отсутствует config.inc.php
- 2. А дальше mod_security не пускает
- 3. config.inc.php не в том месте
- 4. open_basedir restrictions
- 5. Протереть монитор, выдавить стекло
phpMyAdmin HTTP 403 (Forbidden)
Читаем журнал сервера:
script does not have ExecCGI enabled
$ sudo less /home/www/.logs/www-error.log|grep phpmyad|less
[Fri Aug 05 04:50:40.166650 2022] [fcgid:error] [pid 29625:tid 140391388202752]
[client 186.134.15.29:59762] mod_fcgid: location of script /usr/share/phpmyadmin
/index.php does not have ExecCGI enabled
Добавляем недостающее ExecCGI
$ sudo vi /etc/phpmyadmin/apache.conf # phpMyAdmin default Apache configuration Alias /phpmyadmin /usr/share/phpmyadmin <Directory /usr/share/phpmyadmin> Options +FollowSymLinks +ExecCGI DirectoryIndex index.php AuthUserFile "/var/www/.htpasswd" AuthName "Administrator only" AuthType Basic require valid-user Satisfy all ... </Directory>
ещё одной из причин может оказаться mod_security
, как оно выключается будет далее…
phpMyAdmin blowfish_secret
В конфигурационном файле необходимо задать парольную фразу (blowfish_secret).
The configuration file now needs a secret passphrase (blowfish_secret).
Весёлая история, особенно если phpMyAdmin устанавливался не вручную, а из пакетов…
Требования к blowfish_secret:
- определяется в config.inc.php корневой директории phpmyadmin;
- должно быть не менее 32 символов
1. Отсутствует config.inc.php
По-умолчанию файл конфигурации /usr/share/phpmyadmin/config.inc.php
в корневой директории phpmyadmin отсутствует — тут всё понятно, скопировали:
$ sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
Отредактировали:
$ sudo vi /usr/share/phpmyadmin/config.inc.php /** * This is needed for cookie based authentication to encrypt password in * cookie. Needs to be 32 chars long. */ $cfg['blowfish_secret'] = 'viyie0quoo1oobie5ai4othohQui6zeo'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Не помогло? Поехали дальше…
2. А дальше mod_security не пускает
Отключаем
$ sudo vi /etc/phpmyadmin/apache.conf <Directory /usr/share/phpmyadmin> ... <IfModule security2_module> SecRuleEngine Off SecRuleRemoveById 920350 980130 949110 942140 200004 </IfModule> </Directory>
Опять не помогло? От phpMyAdmin-а маму…
3. config.inc.php не в том месте
Так тоже бывает, ой как бывает…
$ sudo vi /usr/share/phpmyadmin/libraries/vendor_config.php /** * Directory where configuration files are stored. * It is not used directly in code, just a convenient * define used further in this file. */ define('CONFIG_DIR', '/etc/phpmyadmin/'); /** * Filename of a configuration file. */ define('CONFIG_FILE', CONFIG_DIR . 'config.inc.php');
Оказывается config.inc.php ожидается в /etc/phpmyadmin/ — передвигаем
$ sudo mv /usr/share/phpmyadmin/config.inc.php /etc/phpmyadmin/
Проверяем, ну, как? Снова не? От йоханый phpMyAdmin, разорви его ракета…
4. open_basedir restrictions
$ sudo less /home/www/.logs/www-access.log|grep access|less ... [05-Aug-2022 06:24:53 Europe/Helsinki] phpmyadmin: Failed to load /var/lib/phpmyadmin/blowfish_secret.inc.php Check group www-data has read access and open_basedir restrictions. [05-Aug-2022 06:24:53 Europe/Helsinki] phpmyadmin: Failed to load /var/lib/phpmyadmin/config.inc.php Check group www-data has read access and open_basedir restrictions. [05-Aug-2022 06:24:53 Europe/Helsinki] phpmyadmin: Failed to load /etc/phpmyadmin/config-db.php Check group www-data has read access and open_basedir restrictions.
Думаю понятно, что нужно делать? php.ini
у каждого хоста своё, находим там open_basedir и добавляем туда /var/lib/phpmyadmin/
и /etc/phpmyadmin/
; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory ; or per-virtualhost web server configuration file. ; http://php.net/open-basedir ;open_basedir = open_basedir = /home/www:/usr/local/lib/php:/usr/lib/php:/usr/local/lib/php5:/usr/lib/php5:/proc:/usr/share:/var/lib:/etc/phpmyadmin:/usr/share/phpmyadmin
Ну, как, теперь арбайтен? НаАайн???
5. Протереть монитор, выдавить стекло
Ну.., тогда.., как нас уверят многие «копирасты», переменную $cfg[‘blowfish_secret’] указать именно в определённом порядке следования:
Если описанные выше способы не помогают, то точно выручит следующее:
Созданный ранее конфиг удаляем, чтобы не мешался и не влиял на работу того, что и без него работало:
# rm /usr/share/phpmyadmin/config.inc.php
Открываем реальный конфиг phpMyAdmin, который находится тут → /etc/phpmyadmin/config.inc.php и дописываем куда-нибудь в конец строку с переменной $cfg[‘blowfish_secret’], например, после этих двух строчек:
$cfg[‘UploadDir’] = »;
$cfg[‘SaveDir’] = »;
$cfg[‘blowfish_secret’] = ‘12345678901234567890123456789012’;После этого ошибка в phpMyAdmin больше не появляется.
А чтобы 100%-я капитальная полная гарантия, вдобавок перезапустить браузер или перезагрузить весь ПК сразу — тогда уж точно всё вмиг засияет! :))
I have installed MySQL server enterprise 5.1 on my local machine and now I want to install phpMyAdmin, but it does not work.
I have unrared phpMyAdmin to my server root directory and browsed to «localhost/phpMyAdmin/setup/index.php», started a new server and the only setting I changed was filling in my MySQL password in the field «Password for config auth»
So now when I am trying to log in I get an error message saying «#2002 cannot log in to the mysql server phpmyadmin»
Does anyone know what’s wrong? I’ve been having this problem since yesterday.
asked Sep 12, 2010 at 11:02
4
If you’re getting the #2002 Cannot log in to the MySQL server
error while logging in to phpmyadmin, try editing phpmyadmin/config.inc.php
and change:
$cfg['Servers'][$i]['host'] = 'localhost';
to:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
Solution from Ryan’s blog
Edit (20-Mar-2015):
Note that if you’re on a fresh install, config.inc.php may not exist. You need to rename / copy config.sample.inc.php and then change the relevant line
answered Apr 17, 2013 at 13:37
koutonkouton
1,9412 gold badges19 silver badges34 bronze badges
5
This is old but as it is the first result in Google,
Please note that this also happens when your MySql service is down,
I fixed this by simply restarting MySQL Server using:
/etc/init.d/mysql restart
in SSH (Command is for a CentOS/CPanel server)
answered May 20, 2015 at 14:29
VladimirVladimir
1,6022 gold badges18 silver badges40 bronze badges
0
Background:
I am using Linux Mint 13. In my case, this error happened when I restarted the computer and my DHCP assigned a new local IP address (from 192.168.0.2 to 192.168.0.4) to my desktop.
sudo gedit /etc/mysql/my.cnf
Update
bind-address = 192.168.0.2
to
bind-address = localhost
This fixed the problem. Enjoy.
Zenexer
18.8k9 gold badges71 silver badges77 bronze badges
answered Dec 29, 2013 at 16:36
KnightKnight
931 silver badge4 bronze badges
2
This can also be caused if you forget (as I did) to move config.inc.php
into its proper place after completing the setup script.
After making the config
folder and doing chmod o+rw config
and going to localhost/phpmyadmin/setup
and following those steps, you need to go back to the command line and finish things off:
mv config/config.inc.php . # move file to current directory
chmod o-rw config.inc.php # remove world read and write permissions
rm -rf config # remove not needed directory
See full instructions at https://phpmyadmin.readthedocs.org/en/latest/setup.html
answered Nov 16, 2013 at 18:36
Geoffrey BoothGeoffrey Booth
7,1685 gold badges35 silver badges42 bronze badges
1
After trying all of the above suggestions here is what fixed my #2002 error.
Add the following line to your config.inc.php file and change the number to your MySQL port:
$cfg['Servers'][$i]['port'] = '3307'; // MySQL port
I had multiple mysql instances installed, and in this case, I had updated my.ini to run MySQL on port 3307, but had not updated phpMyAdmin to reflect the new port. In my case, the line for the port did not exist in the config.inc.php file, so I was not aware that it needed updating.
answered May 5, 2014 at 16:06
Did you set up the MySQL on your machine? It sounds like you’re using Windows; MySQL runs as a «Service» on your machine (right-click My Computer -> Manage -> Services).
answered Sep 12, 2010 at 11:07
amphetamachineamphetamachine
27.8k12 gold badges60 silver badges72 bronze badges
1
I’ve been through basically all of stackoverflow for this error and nothing resolved my issue. I was able to log into mysql directly from the linux command line fine, but with the same user and password couldn’t log into phpmyadmin.
So I beat my head against the wall for half the day until I realized it wasn’t even reading the config.inc.php under /etc/phpmyadmin (the only place it was located btw based on «find / -iname config.inc.php». So I changed the host in /usr/share/phpMyAdmin/libraries/config.default.php and it finally worked.
I know there’s probably another issue with why it isn’t reading the config from the /etc/phpmyadmin folder but I can’t be bothered with that for now
tldr; if your settings don’t seem to be applying at all try making the changes within /usr/share/phpMyAdmin/libraries/config.default.php
answered Feb 20, 2015 at 18:03
1
I have also experienced the same thing, hopefully a this helps.
cd /etc/init.d
./mysql start
please login to access mysql and phpmyadmin
Rohit Gupta
4,02420 gold badges31 silver badges41 bronze badges
answered Oct 21, 2015 at 1:04
0
It happened with me when I changed the instance type of my AWS server.
#2002 Cannot log in to the MySQL server
can also occur when the mysqld
service is not started.
So first of all you need to execute :
$ sudo service mysqld restart
This will give you :
$ sudo service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
After that the error will not come.
P.S. On EC2 instances, one should also change the host from localhost
to 127.0.0.1
as mentioned in the top answer.
answered Jun 15, 2016 at 20:43
driftking9987driftking9987
1,6731 gold badge32 silver badges63 bronze badges
- Right-click My Computer -> Manage -> Services
- Choose «Services» under the «Services and Application» from right pane
- Then search for the «Zend Development» Service.
- When you find it, double click to start that service.
Now, you should be able log in to phpMyAdmin.
pjmorse
9,2149 gold badges54 silver badges124 bronze badges
answered Sep 8, 2012 at 6:45
1
I had same issue after the server has been attacked using a DDoS (actually a penetration testing tool).
I’ve headed to /etc/var/mysql/error.log first to see the InnoDB had a file lock.
The issue was immediately fixed by restarting the server, however that’s not future-proof.
answered Jan 30, 2014 at 16:30
igraczechigraczech
2,4173 gold badges25 silver badges30 bronze badges
In my system, config.inc.php
didn’t exist, but config.sample.inc.php
existed. Try copying the sample script to config.inc.php
answered Jun 22, 2016 at 9:12
Had this problem a number of times on our setup, so I’ve made a check list.
This assumes you want phpMyAdmin connecting locally to MySQL using a UNIX socket rather than TCP/IP.
UNIX sockets should be slightly faster as they have less overhead and can be more secure as they can only be accessed locally.
Service
- Is the mysqld service running?
service mysqld status
- .. If not
service mysqld start
- Has config has changed since service started?
service mysqld restart
MySQL Config (my.cnf)
- Check that there isn’t a non-socket client protocol set, e.g.
protocol=tcp
- Check that the socket location is accessible and has the right permissions
PHP Config (php.ini)
If you can connect locally from the command line, but not from phpMyAdmin, and the socket file is not in the default location:
- Set the mysqli default sockets to the new location:
mysqli.default_socket = *location*
- … I also set the
pdo_myql.default_socket
andmysql.default_socket
just to be sure - Restart your web service (httpd in my case)
service httpd restart
phpMyAdmin Config (config.inc.php)
- Check that the host is set to localhost:
$cfg['Servers'][$i]['host'] = 'localhost';
- The socket location can also be set here:
$cfg['Servers'][$i]['socket'] = '*location*';
N.B.
As pointed out by @chk; Setting the $cfg['Servers'][$i]['host']
from localhost
to 127.0.0.1
just causes the connection to use TCP/IP rather than using the socket and is more of a workaround than a solution.
The MySQL config setting bind-address=
also only affects TCP/IP connections.
If you don’t need remote connections, it is recommended to turn off TCP/IP listening with skip-networking
.
answered Feb 14, 2017 at 13:05
ArthArth
12.8k5 gold badges38 silver badges69 bronze badges
For Ubuntu 14.04 and 16.04, you can apply following commands
First, check MySQL service is running or not using
sudo service mysql status
Now you can see you show a message like this: mysql stop/waiting.
Now apply command: sudo service mysql restart!
Now you can see you show a message like this: mysql start/running, process 8313.
Now go to the browser and logged in as root(username) and root(password) and you will be logged in successfully
answered Jan 5, 2019 at 8:10
In ubuntu OS in ‘/etc/php5/apache2/php.ini’ file do configurations that this page said.
answered Mar 11, 2013 at 17:13
RahaRaha
291 gold badge1 silver badge6 bronze badges
0
For those who get this error when working with WAMP/XAMP on a windows machine.
This may help you.
Your solution is to
- net stop mysql
- Erase binary logs (and the binary log index file)
- IF you do not know where they are, locate my.ini on your PC
- Open my.ini in Notepad look for the option log-bin or log_bin
- Look for the option datadir
- If log-bin only has a filename, look inside the folder specified by datadir
- If log-bin includes a path and a filename, look inside the folder specified by log-bin
- Open the desired folder in Windows Explorer
- Remove the binary logs There should be a file whose
file extension is .index. Delete this as well net start mysql
Please DO NOT ERASE ib_logfile0 or ib_logfile1 when you have binary log issues.
Answer is on dba.stackexchange
answered Feb 16, 2014 at 23:41
heyomiheyomi
3955 silver badges18 bronze badges
CAUTION: This method completely removes MySQL data!
I have same problem in Ubuntu 12.10 , mysql 5.5
I have tested lots of answer related to my issue but none of theme work
at last I had to reinstall remove my mysql server completely and then I install again Mysql server
but you should be aware that you should delete all directory which related to Mysql
I use this link to remove mysql completely
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo deluser mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/run/mysqld
and then you install again LAMP by tasksel
Removing MySQL 5.5 Completely
https://serverfault.com/questions/254629/unable-to-install-mysql-server-in-ubuntu/296928#296928
answered Feb 5, 2014 at 13:45
masoud2011masoud2011
8969 silver badges10 bronze badges
After Many attempts in getting this fixed, it was found out that the issue was with Mysql users not being allowed to login
netstat -na | grep -i 3306
If it is listening on all interfaces, then you can assign any of your interfaces to this
$cfg['Servers'][$i]['host'] = 'ANY INTERFACE';
Try to Login using the above IP using the comand line
mysql -u bla -p -h <Above_IP_address>
If this works then your phpmyadmin will also work, If not fix the mysql.user table so that the above command works and allows you to login to mysql.
answered May 5, 2014 at 12:14
Right-click My Computer -> Manage -> Services
Choose «Services» under the «Services and Application» from right pane
Then search for the «mysql» Service.
When you find it, double click to start that service.
Now you should be able to run and login to PhpMyAdmin
answered Sep 3, 2014 at 13:05
Masivuye CokileMasivuye Cokile
4,7543 gold badges20 silver badges34 bronze badges
Check whether you server is running or not.
answered Oct 1, 2014 at 10:53
It is because your system has two installations of «mysql» packages. One installation was made through xampp/lampp and another installation was made through mysql-debain package. To solve the problem, just go to «synaptic manager» and remove mysql, and then you will be able to access mysql from xampp server.
Note : removing mysql from synaptic manager doesn’t affect mysql which was installed through xampp/lampp server. So don’t worry!
answered Jul 3, 2015 at 13:30
Just in case anyone has anymore troubles, this is a pretty sure fix.
check your etc/hosts file make sure you have a root user for every host.
i.e.
127.0.0.1 home.dev
localhost home.dev
Therefore I will have 2 or more users as root for mysql:
root@localhost
root@home.dev
this is how I fixed my problem.
Rohit Gupta
4,02420 gold badges31 silver badges41 bronze badges
answered Oct 10, 2014 at 20:47
Victor BojicaVictor Bojica
3331 gold badge4 silver badges14 bronze badges
For me the problem was solved by deleting a .pid file named after my computer:
sudo rm /var/mysql/computername.pid
answered Feb 7, 2016 at 13:16
This the following line in your php.ini file
mysql.default_socket = "MySQL"
to
mysql.default_socket = /var/run/mysqld/mysqld.sock
answered Jul 25, 2016 at 4:04
This problem occurs when you already had MySQL installed on your machine or in case you have changed the post number of the MySql service which is 3306(Default). In order to solve this, you have to tell the phpMyAdmin to look for another port instead of 3306. To do so go to C:\xampp\phpMyAdmin(default location) and open Config.inc
and add this line $cfg['Servers'][$i]['port'] = '3307';
after $cfg['Servers'][$i]['AllowNoPassword'] = true;
Restart the services and now it should work.
Francisco
10.9k6 gold badges34 silver badges45 bronze badges
answered Jun 21, 2017 at 7:32
I had an issue with the path of the MySQL service in the Windows 7 registry
which was not changed with the new installed XAMPP or newer easyPHP
version.
So if anybody has the same problem (#2002 error, phpMyAdmin cannot be
started) you can search into the win regedit for ‘my.ini’ and exchange the
path to the new package.
For example I exchanged on a few places the older path:
C:\EASYPH~1.1VC\binaries\mysql\bin\eds-mysqld.exe
—defaults-file=C:\EASYPH~1.1VC\binaries\mysql\my.ini MySQL
with the newer one:
c:\xampp\mysql\bin\mysqld.exe —defaults-file=c:\xampp\mysql\bin\my.ini
mysql
It is strange that nobody described this issue before on the web!
Francisco
10.9k6 gold badges34 silver badges45 bronze badges
answered Feb 9, 2015 at 11:34
my problem is solved by this step
- apt-get install mysql-server phpmy admin
- /etc/init.d/mysql restart
- done.
answered Aug 31, 2018 at 18:24
После установки и настройки ПО выделенного сервера или виртуального сервера
не обходится без недоработок, результатом которых являются ошибки. Рассмотрим
некоторые ошибки, которые могут возникнуть при работе с базами данных
MySQL.
1 ошибка. При попытке зайти в PhpMyAdmin, пишет «#1045 — Access denied for
user ‘root’@’localhost’ (using password: NO)» либо YES в конце если с паролем.
Возможно, вы неправильно ввели пароль, но есть и другая причина: при
cookie-аутентификации, в конфигурационном файле config.inc.php необходимо задать
парольную фразу, установив значение директивы $cfg[‘blowfish_secret’].
То есть, в /etc/phpmyadmin/config.inc.php написать
$cfg['blowfish_secret']='pr0izvOlniyText';
pr0izvOlniyText — любое слово. Если установку ПО проводит хостер, обычно он и
указывает это кодовое слово, но иногда забывают.
2 ошибка. В панели ISP manager при нажатии ссылки «Базы данных» в
инструментах выдается Внутренняя ошибка Can’t connect to database. Через
PhpMyAdmin базы данных доступны.
Исправляем:
В раздале сервера баз данных панели, сервер mysql указываем новый root пароль и
его же прописываем в root пароль mysql там же (т.е. два раза надо будет нажать ок).
Ошибка Access denied for user 'root'@'localhost'
означает, что у пользователя root с указываемым вами паролем нет прав доступа к СУБД.
Видимо пароль не установился или установился не верно, либо вместо ‘root’@’localhost’ был установлен пользователь ‘root’@127.0.0.1. Попробуйте в консоли набрать
mysql -h 127.0.0.1 -u root -p
Если после этого вас пустит в СУБД, необходимо создать дополнительного пользователя ‘root’@’localhost’
GRANT ALL ON *.* TO 'root'@'localhost'
WITH GRANT OPTION
IDENTIFIED BY 'password'
Если не пускает, значит, нужно восстанавливать пароль для root. Найдите конфигурационный файл my.cnf и добавьте в секцию [mysqld] директиву skip-grant-tables
, которая отключит проверку прав доступа
[mysqld]
...
skip-grant-tables
После чего перезагрузите сервер. Теперь вы можете входить MySQL без пароля, войдите и переустановите пароль
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
После этого следует убрать директиву skip-grant-tables
из my.cnf и перезапустить сервер.
Сначала расскажу что я сделал, а потом к сути вопроса.
На голый сервер поставил VESTA, который собственно сам и накатил PHPMyAdmin, после авторизации на котором, возникали следующие ошибки и как я их решил:
- Ошибка при указании соединения для controluser в конфигурации:
— Подсмотрел логин и пароль в файле /usr/local/vesta/conf/mysql.conf
— Ввел их в /etc/phpmyadmin/config.inc.php ($cfg[‘Servers’][$i][‘controluser’] и $cfg[‘Servers’][$i][‘controlpass’]) - Дополнительные возможности phpMyAdmin не настроены в полной мере, некоторые функции были отключены.
— Ввел все те же логин и пароль в /etc/phpmyadmin/config.inc.php ($cfg[‘Servers’][$i][‘controluser’] и $cfg[‘Servers’][$i][‘controlpass’])
— Скачал пример бэкапа /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz и импортировал его
— В /etc/phpmyadmin/config.inc.php указал таблицы в соответствии с импортируемой бд (добавил знак подчеркивания: pma_bookmark => pma__bookmark и т.п.)
После проделанных шагов PMA прекрасно заработал и более не ругался, но ровно до того момента когда время авторизации истекло и меня не выбило. И теперь я не могу войти под любыми парами логин-пароль, в т.ч. root.
Отображаемые ошибки:
#2002 Невозможно подключиться к серверу MySQL
Ошибка при указании соединения для controluser в конфигурации.