Jump to content

[Solved] How To Access External Database Allowed In Another Host?


darlingss

Recommended Posts

Help me please!!

 

I have a database in another host in where i am SUPER USER, i dont use heliohost database because i cant execute EVENTS MYSQL and then i decided use my database in another host where i can EXECUTE EVENTS

 

THE QUESTION!!

 

When i am trying connect to my external database I JUST GET INTERNAR SERVER ERROR 500, the dates of conecction are correct i dont undertand that message !!

 

Please help me

Link to comment
Share on other sites

You should just be able to just use the other database server's host name instead of localhost. Be aware though, it does have to be running on port 3306 on the remote server since we block most nonstandard ports.

Link to comment
Share on other sites

You should just be able to just use the other database server's host name instead of localhost. Be aware though, it does have to be running on port 3306 on the remote server since we block most nonstandard ports.

Are correct, I use port 3306 and the IP/nameHost external database, but not fucntion INTERNARL SERVER ERROR 500

Link to comment
Share on other sites

I'm assuming you've fixed the port number issue Krydos pointed out above? As for events, I'm not sure we support it.

 

I'll escalate this since it still doesn't work and I don't know about the SQL events.

Link to comment
Share on other sites

I need to make this... but the option run event is block because im not super user

 

ver evento activo

show variables like '%event%';

 

activar eventos

set GLOBAL event_scheduler=ON;

 

EVENTO

 

CREATE EVENT act_reservacion

ON hotelescuela EVERY 1 DAY STARTS ‘2016-07-11 12:00:00’ + interval 1 day

DO

UPDATE habitaciones

INNER JOIN DETALLES ON habitaciones.id = detalles.idhabitacion

INNER JOIN RESERVACIONES ON reservaciones.id = detalles.idreservacion

SET habitacione.status = 0

WHERE reservaciones.fechaPart = now();

Link to comment
Share on other sites

You can easily do that with a PHP script and a cron job. That's the way I'd recommend it be done.

 

Something like this (not tested, may have syntax errors). Run it from a once per day cron job.

<?php
$connection = mysqli_connect("localhost","databasename","user","password");
$update = mysqli_query($connection,"UPDATE habitaciones INNER JOIN DETALLES ON habitaciones.id = detalles.idhabitacion INNER JOIN RESERVACIONES ON reservaciones.id = detalles.idreservacion SET habitacione.status = 0 WHERE reservaciones.fechaPart = '".time()."'");
?>
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...