Get Wordpress Database Credentials

Last modified: 
Thursday, April 9th, 2015

Quickly retrieve Wordpress DB info from a terminal

The following command will return the database credential information from a Wordpress installation's wp-config.php file.

cat wp-config.php | grep DB_


$ cat wp-config.php | grep DB_
define('DB_NAME', 'dbname');
define('DB_USER', 'dbuser');
define('DB_PASSWORD', 'dbpassword');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.