Access A WordPress Database with Pressable

Category: FAQ | Last modified: August 28, 2020

For security reasons, we do not allow remote access to a Pressable site’s database. We also do not allow remote connections to external databases. For more information, please see our Platform and Service Considerations.

However, if you wish to connect to your Pressable site’s database programmatically from within your site, such as via PHP Data Objects (PDO) or MySQLi, you may do so.

If you’re using PDO or MySQLi within WordPress, you can use the PHP constants defined for database access:

<?php
require 'wp-load.php';
$connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

If you are not accessing the database from within WordPress (i.e. via a PHP script that functions outside of WordPress), then you can use the following script to output the database credentials necessary for a PDO or MySQLi connection:

<?php
require 'wp-load.php';
// Display WP database credentials
echo "DB NAME :".DB_NAME ."<br>";
echo "DB USER :".DB_USER ."<br>";
echo "DB HOST :".DB_HOST ."<br>";
echo "DB PASSWORD :".DB_PASSWORD;

If you have any questions, please contact support.

An Automattic Invention A family of WordPress solutions.