sql >> Database >  >> RDS >> Mysql

Hoe open ik een DB-verbinding in Openshift?

Ik heb het laten werken door dit te doen.

Globaal gebruik

define('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST'));
define('DB_PORT', getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_USER', getenv('OPENSHIFT_MYSQL_DB_USERNAME'));
define('DB_PASS', getenv('OPENSHIFT_MYSQL_DB_PASSWORD'));
define('DB_NAME', getenv('OPENSHIFT_GEAR_NAME'));

$dbhost = constant("DB_HOST"); // Host name 
$dbport = constant("DB_PORT"); // Host port
$dbusername = constant("DB_USER"); // MySQL username 
$dbpassword = constant("DB_PASS"); // MySQL password 
$db_name = constant("DB_NAME"); // Database name 

Alternatief

$dbhost = getenv('OPENSHIFT_MYSQL_DB_HOST'); // Host name 
$dbport = getenv('OPENSHIFT_MYSQL_DB_PORT'); // Host port
$dbusername = getenv('OPENSHIFT_MYSQL_DB_USERNAME'); // MySQL username 
$dbpassword = getenv('OPENSHIFT_MYSQL_DB_PASSWORD'); // MySQL password 
$db_name = getenv('OPENSHIFT_GEAR_NAME'); // Database name 



  1. Probleem met utf-8-codering met PHP + MySQL

  2. SELECT INTO werkt niet

  3. SQL-statements Fout in Java-code bij gebruik van Intellij en DB Navigator

  4. Salesforce TLS 1.0 Beëindiging