Reply to Cannot connect to mysql database on another server with phpmyadmin.

Your name:

Reply:


Posted by Pugi! on 04/10/07 09:31

At my company we want a new configuration for our webservers. Two
loadbalanced webservers (linux and apache) and one database and (nfs)
fileserver. MySQL is only installed on db server. Apache is only
installed on webservers. (Even the websites (files) are on the dbnfs
server, mounted with an nfs mount to the webservers).
When I want to use phpmyadmin to connect to the database I get
#2002 - The server is not responding (or the local MySQL server's
socket is not correctly configured)

I already made changes to php.ini and config.inc.php (phpmyadmin) but
keep getting same error message. There is no local socket. MySQL is
not installed on the webserver. I did install apache with mysql
support.

I have no problem making a connection with a php-script
(mysql_connect('192.168.6.3', 'username', 'password')), selecting
database and executing a query. So I guess the settings in the php.ini
are correct.

Info from phpinfo();
mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.1.20
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host 192.168.6.3 192.168.6.3
mysql.default_password no value no value
mysql.default_port 3306 3306
mysql.default_socket 192.168.6.3:/var/lib/mysql/mysql.sock
192.168.6.3:/var/lib/mysql/mysql.sock
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off

conf.inc.php (phpmyadmin)
$i++;

/* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'cookie';

/* Server parameters */

$cfg['Servers'][$i]['host'] = '192.168.6.3:3306';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

/* Select mysqli if your server has it */

$cfg['Servers'][$i]['extension'] = 'mysql';

php.ini
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no
limit.
mysql.max_links = -1

; Default port number for mysql_connect(). If unset, mysql_connect()
will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will
only look
; at MYSQL_PORT.
mysql.default_port = 3306

; Default socket name for local MySQL connects. If empty, uses the
built-in
; MySQL defaults.
mysql.default_socket = /var/lib/mysql/mysql.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = 192.168.6.3

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this
file.
; *Any* user with PHP access can run 'echo
get_cfg_var("mysql.default_password")
; and reveal this password! And of course, any users with read access
to this
; file will be able to reveal the password as well.
mysql.default_password =

; Maximum time (in seconds) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/
index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация