Issue
I got ERR_CONNECTION_REFUSED
when I tried to connect phpmyadmin to mariadb on an external server seeing http://192.168.10.165/phpmyadmin
.
src="https://i.stack.imgur.com/2kEpc.png" alt="enter image description here" />
Here is the list of server.
- masterDB(192.168.10.165)
- maxscale(192.168.10.175)
- phpmyadmin(192.168.10.185)
This is the setting of [/etc/phpmyadmin/config.inc.php]
$i++;
$cfg['Servers'][$i]['host'] = '192.168.10.165';
$cfg['Servers'][$i]['user'] = 'phpmyadmin';
$cfg['Servers'][$i]['password'] = 'test123';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '/var/run/mysqld/mysqld.sock';
Here are some setting of mariadb and maxscale
mariadb
[mysqld]
pid-file = /run/mysqld/mysqld.pid
basedir = /usr
socket=/run/mysqld/mysqld.sock
bind-address = 0.0.0.0
proxy_protocol_networks = 192.168.10.175/24, localhost
server-id = 1
max_connections = 5000
log_error = /var/log/mysql/error.log
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
grants for phpmyadmin
+---------------------------------------------------------------------------------------------------------------------------------+
| Grants for [email protected] |
+---------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `phpmyadmin`@`192.168.10.185` IDENTIFIED BY PASSWORD '*9678F24DBDAFA9F106368B335C371B581501E926' |
+---------------------------------------------------------------------------------------------------------------------------------+
maxscale
[maxscale]
threads=auto
log_info=true
log_warn_super_user=true
syslog=true
maxlog=true
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=masterDB, replicaDB1, replicaDB2
user=monitor
password=test123
monitor_interval=2s
[masterDB]
type=server
address=192.168.10.165
port=3306
protocol=MariaDBBackend
proxy_protocol=true
monitoruser=monitor
monitorpw=test123
persistpoolmax=5000
max_routing_connections=3000
persistmaxtime=3600s
[Write-Service]
type=service
router=readconnroute
router_options=master, slave
servers=masterDB
user=maxscale
password=test123
idle_session_pool_time=15s
multiplex_timeout=40s
max_connections=2000
[Write-Listener]
type=listener
service=Write-Service
protocol=MariaDBClient
port=3309
address=0.0.0.0
I changed $cfg['Servers'][$i]['host'] = '192.168.10.165';
to $cfg['Servers'][$i]['host'] = '192.168.10.175:3309';
because I thought the parameter "proxy_protocol_networks" caused this problem, but I saw same result like a picture I put above.
I got NOT FOUND
error when I saw http://192.168.10.185/phpmyadmin
I'd like to know
- How to solve
ERR_CONNECTION_REFUSED
- Is it possible that the parameter "proxy_protocol_networks" causes this error.
Could anyone help me, please?
Thank you so much for everything you've taught me. I found the causes of this error. They are 2 reasons below.
- Wrong URL (the right URL was
http://192.168.10.185/phpmyadmin
) - Wrong setting in
/etc/phpmyadmin/config.inc.php
(I fixed some values of parameters what I added and also changed values of parameters that are configured from the beginning)
I hope this picture below is helpful to understand what I did in /etc/phpmyadmin/config.inc.php
.
setting of /etc/phpmyadmin/config.inc.php
Solution
- Wrong URL (the right URL was http://192.168.10.185/phpmyadmin)
- Wrong setting in /etc/phpmyadmin/config.inc.php (I fixed some values of parameters what I added and also changed values of parameters that are configured from the beginning)
$i++;
$cfg['Servers'][$i]['host'] = '192.168.10.165';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['user'] = 'phpmyadmin';
$cfg['Servers'][$i]['password'] = 'test123';
if (!empty($dbname)) {
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
if (empty($dbserver)) $dbserver = '192.168.10.165'; # here!
$cfg['Servers'][$i]['host'] = '192.168.10.165'; # here!
if (!empty($dbport) || $dbserver != 'localhost') {
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['port'] = $dbport;
}
//$cfg['Servers'][$i]['compress'] = false;
/* Optional: User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'phpmyadmin'; # here!
$cfg['Servers'][$i]['controlpass'] = 'test123'; # here!
Answered By - hekke Answer Checked By - Candace Johnson (WPSolving Volunteer)