We run our MySQL 5 server on a non standard port due to a parallel install of MySQL 4 (migration in process). Thus, the database server I want is not on port 3306. But when I specify db.host.com:3307, I get this message back:
Unknown MySQL server host 'db.host.com:3307'
I'm doing expert install, and there is no Mysql port option in the database options. And from looking through functions_installer.inc.php, it seems that S9y doesn't even support that option at all.
How can I get around this?
Thanks!
How to specify the MySQL port?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: How to specify the MySQL port?
Hi!
Which PHP version and mysql client library are you using?
Entering the DBhost as "db.host.com:3307" should work. If you are running a DB server on db.host.com and it works there when you enter "db.host.com" try to enter "db.host.com:3306" to see if it generally works.
It might be your mysql server is only running using Sockets and not ports, and thus the connection fails.
According to the docs on mysql_connect() on www.php.net, specifying the port after the hostname is correct. If you are running an old PHP version or old MySQL client libs this might be different for you.
Best regards,
Garvin
Which PHP version and mysql client library are you using?
Entering the DBhost as "db.host.com:3307" should work. If you are running a DB server on db.host.com and it works there when you enter "db.host.com" try to enter "db.host.com:3306" to see if it generally works.
It might be your mysql server is only running using Sockets and not ports, and thus the connection fails.
According to the docs on mysql_connect() on www.php.net, specifying the port after the hostname is correct. If you are running an old PHP version or old MySQL client libs this might be different for you.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: How to specify the MySQL port?
php5 -vgarvinhicking wrote:Hi!
Which PHP version and mysql client library are you using?
PHP 5.1.2 (cli) (built: Mar 7 2007 21:53:56)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
apt-cache show php5-mysqli
Package: php5-mysqli
Priority: optional
Section: web
Installed-Size: 160
Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: i386
Source: php5
Version: 5.1.2-1ubuntu3.6
It would seem that way, but apparently when that host/port string is being passed to the driver, it's not seeing it as two separate things, because this is the error I get back on the admin page:garvinhicking wrote: Entering the DBhost as "db.host.com:3307" should work. If you are running a DB server on db.host.com and it works there when you enter "db.host.com" try to enter "db.host.com:3306" to see if it generally works.
It might be your mysql server is only running using Sockets and not ports, and thus the connection fails.
According to the docs on mysql_connect() on www.php.net, specifying the port after the hostname is correct. If you are running an old PHP version or old MySQL client libs this might be different for you.
Code: Select all
Could not connect to database; check your settings.
The mySQL error was: Unknown MySQL server host 'db.host.com:3307' (1)
According to the mysqli docs, the host and port are two separate entities:
Procedural style
mysqli mysqli_connect ( [string $host [, string $username [, string $passwd [, string $dbname [, int $port [, string $socket]]]]]] )
Object oriented style (constructor):
class mysqli {
__construct ( [string $host [, string $username [, string $passwd [, string $dbname [, int $port [, string $socket]]]]]] )
}
In the mysql extension, the port number can be part of host name. So, I guess my "problem" is that I was trying to use the mysqli extension, and s9y isn't coded to use a custom port when using mysqli. I guess I'll use the mysql extension. I didn't assume there would be any difference either, so in my original post, I never wrote about the fact that I was using mysqli. Sorry if that created unnecessary confusion.port
Specifies the port number to attempt to connect to the MySQL server.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: How to specify the MySQL port?
Hi!
Ah, mysqli was the clue.
I committed this patch, maybe you can try it:
http://svn.berlios.de/viewcvs/serendipi ... 47&r2=1659
HTH,
Garvin
Ah, mysqli was the clue.
I committed this patch, maybe you can try it:
http://svn.berlios.de/viewcvs/serendipi ... 47&r2=1659
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: How to specify the MySQL port?
I replaced that file, changed my config to MySQLi, my config_local says I'm using mysqli, and all seems to be working well.garvinhicking wrote:Ah, mysqli was the clue.
I committed this patch, maybe you can try it:
http://svn.berlios.de/viewcvs/serendipi ... 47&r2=1659
Thanks for the quick fix!
j