Multiplay Labs

tech hits and tips from Multiplay

Archive for the ‘mysql’ tag

Building DBD::mysql under Cygwin with mysql 5.5

without comments

The following instructions will enable you to build DBD::mysql under Cygwin using mysql 5.5 sources.

1. First download the latest mysql source from http://dev.mysql.com/downloads/mysql/
2. Expand the source and change into the directory e.g. tar -xzf mysql-5.5.21.tar.gz; cd mysql-5.5.21
3. Prepare the Makefiles using cmake, we need to disable shared libs to avoid having to mess with LD_LIBRARY_PATH.

cmake . -DCMAKE_LEGACY_CYGWIN_WIN32=0 -DCMAKE_INSTALL_PREFIX=/usr/local -DDISABLE_SHARED=1

4. Build the client and libs:

make mysqlclient libmysql

4.1. If the build errors with duplicate definition for dtoa, then you can fix it by commenting out the cygwin definition in: /usr/include/stdlib.h (dont forget to remove the comment when done)
5. Install mysql components

sh -c 'for dir in client libmysql scripts include; do cd $dir; make install; cd -; done'

6. Build and install DBD::mysql via CPAN, if you don’t have a running mysql instance you may need to “force” install

perl -MCPAN -e shell
cpan[1]> install DBD::mysql

Written by Dilbert

February 29th, 2012 at 9:29 pm

Posted in Cygwin,Perl

Tagged with , , ,

ultrastats mysql database port fix

without comments

Just been playing more with ultrastats and went to set it up on our test db which runs on a none standard port. After fighting with it for 1/2 an hour it telling me access denied I looked at to code to find the nice port option it asks you for in the installer was totally and utterly ignored 🙁

Here’s the patch

--- ./install.php.orig	Tue Feb 24 21:19:24 2009
+++ ./install.php	Tue Feb 24 21:21:38 2009
@@ -240,5 +240,5 @@
 
 	// Now Check database connect
-	$link_id = mysql_connect( $_SESSION['DB_HOST'], $_SESSION['DB_USER'], $_SESSION['DB_PASS']);
+	$link_id = mysql_connect( "{$_SESSION['DB_HOST']}:{$_SESSION['DB_PORT']}", $_SESSION['DB_USER'], $_SESSION['DB_PASS']);
 	if (!$link_id) 
 		RevertOneStep( $content['INSTALL_STEP']-1, GetAndReplaceLangStr( $content['LN_INSTALL_ERRORCONNECTFAILED'], $_SESSION['DB_HOST']) . "<br>" . DB_ReturnSimpleErrorMsg() );
--- ./include/functions_db.php.orig	Tue Feb 24 21:24:00 2009
+++ ./include/functions_db.php	Tue Feb 24 21:24:48 2009
@@ -43,5 +43,5 @@
 
 	//TODO: Check variables first
-	$link_id = @mysql_connect($CFG['DBServer'],$CFG['User'],$CFG['Pass']);
+	$link_id = @mysql_connect("{$CFG['DBServer']}:{$CFG['Port']}",$CFG['User'],$CFG['Pass']);
 	if (!$link_id) 
 		DB_PrintError("Link-ID == false, connect to ".$CFG['DBServer']." failed", true);

Written by Dilbert

February 24th, 2009 at 10:41 pm

Posted in Hackery,MySQL

Tagged with , , ,