My suggestion, if you just want to move data between the 2 servers, is to mysqldump to a file, scp the file to the destination server and then mysql < filename to get it into the second server. You can't do it under programmatic control but it will work and your data will remain secure in transport.
=C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -----Original Message----- From: Stefen Lars [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 10:24 AM To: [EMAIL PROTECTED] Subject: [PHP] Secure MySQL connections in PHP with 'stunnel' Hello all I have written a very simple PHP script to copy the data from one MySQL database table on SERVERA to another MySQL database table on SERVERB. Using PHP, I simply connect to each server and copy the data across. That works well. However, natively, MySQL works with clear text. i.e. the data is copied across the Internet in clear text (a bad thing). I would now like encrypt the MySQL data between SERVERA and SERVERB. After searching with Google, I see that stunnel is a tool to use. However, I have been trying with no avail to create an encrypted connection between the two servers from MySQL to work. Following the instructions at: http://www.zataz.net/php-stunnel-tuneling.php I have come up with the following: SERVERA (master) /usr/local/sbin/stunnel -f -P/tmp/ -c -d 3308 -r SERVERA:3307 /usr/local/sbin/stunnel -f -P/tmp/ -p /usr/local/ssl/certs/stunnel.pem -d 3307 -r 3306 SERVERB (slave) /usr/local/sbin/stunnel -f -P/tmp/ -c -d 3308 -r SERVERB:3307 /usr/local/sbin/stunnel -f -P/tmp/ -p /usr/local/ssl/certs/stunnel.pem -d 3307 -r 3306 This does not work. When I connect to the slave with: <?PHP $db_link = mysql_connect(SERVERB:3308, "User", "Pwd") or die("Cannot connect to db"); mysql_select_db("DBNAME",$db_link) or die("Cannot select MASTER db\n"); ?> and select / insert data into SERVERB, the data is selected / inserted to the database on SERVERA. This is very strange. Has anyone else tried using stunnel to achieve what I want to do? If so, I would REALLY like to hear how you achieve the encrypted link. Or are there other ways of securely coping data from one MySQL server to another? Using stunnel seems rather fiddly… Any comments on this subject will be well received. Stefen _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php