[Gambas-user] MySQL access example

charlesg charles at ...1784...
Sun Dec 6 11:17:32 CET 2009


Hi

I don't think Gambas is too particular where it reads the mySQL server.

If you mean remote on network (not remote on internet) then the following
(for Ubuntu) might help.

Set router to use fixed addresses or at least ensure that the mySQL server
boots first to always use same address.

on server:
comment out skip-networking in /etc/mysql/my.cnf
comment out bind address in /etc/mysql/my.cnf
(I am not sure this is too secure but it works - would welcome expert
comment on this!)

allow remote connection from your lan subnet e.g. 192.168.1.0/24:
sudo /sbin/iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp
--destination-port 3306 -j ACCEPT
(you may not be using eth0)

grant all on stock.* to charles@'192.168.2.3' identified by 'dog';
from mySQL on server.

from terminal on the remote machine you should be able to connect now with:
mysql -h 192.168.1.2 -u charles -p
(where the address is the server address)

Once that works, Gambas simply becomes:
	WITH conn
      		.Type = "mysql"
     		.Host = "192.168.1.5" (or whatever)
      		.Login = "charles"
     		.password = "dog"
     		.Name = "stock"
 	 END WITH
 	 TRY conn.Open
-- 
View this message in context: http://old.nabble.com/MySQL-access-example-tp26660182p26663560.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list