forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: kazekun on December 10, 2008, 10:52:31 am

Title: [Solved]: How to change coppermine database port
Post by: kazekun on December 10, 2008, 10:52:31 am
I've installed coppermine with database connection on port 3306 some time ago and it's working fine.  Recently, I need to change the mysql database from the default port to another port .  Now when I try to access the photo gallery, it says

Coppermine critical error:
Unable to connect to database !

MySQL said: Lost connection to MySQL server at 'reading initial communication packet', system error: 111

I've googled around and found a similar post (http://forum.coppermine-gallery.net/index.php?topic=53674.0) with the solution of "Edit include/config.inc.php and specify the port. For example localhost:3305".  I would like to ask how to make the aforementioned change in the config.php.  In the config.php, it has

// MySQL configuration
$CONFIG['dbserver'] =                         '127.0.0.1';        // Your database server
$CONFIG['dbuser'] =                         'xxxx';        // Your mysql username
$CONFIG['dbpass'] =                         'xxxx';                // Your mysql password
$CONFIG['dbname'] =                         'xxxxi';        // Your mysql database name

So where do I add in the new port number? I tried $CONFIG['dbserver'] = '127.0.0.1:23800' and it didn't work.
Title: Re: How to change coppermine database port
Post by: Hein Traag on December 10, 2008, 11:05:01 am
Have you tried localhost:23800 ?
Title: Re: How to change coppermine database port
Post by: kazekun on December 10, 2008, 02:03:31 pm
Cannot use localhost:xxxxx, because my apache is in chroot, so the mysql.sock is not in the default /tmp/mysql.sock.  That's why in the user account I need to set host part as 127.0.0.1 instead of localhost in the first place.  I tried the suggestion of localhost:xxxxx (also created user account 'username'@'localhost' in mysql for this purpose), which resulted in the following error message:

Coppermine critical error:
Unable to connect to database !

MySQL said: Can't connect to local MySQL server through socket '/chroot/apache/tmp/mysql.sock' (2)
Title: Re: How to change coppermine database port
Post by: kazekun on December 10, 2008, 02:11:39 pm
Actually, got it working now by using 'server_ipaddr:23800'.  (tried it before but I seemed to have put the wrong port number in at that time).  Anyway, many thanks for your help! ^_^
Title: Re: How to change coppermine database port
Post by: Hein Traag on December 10, 2008, 02:20:33 pm
Your welcome and thanks for the info on the port number setting. Bound to be usefull to others.