Store database credentials from wp-config in shell variable

PHOTO EMBED

Mon Jun 07 2021 18:06:54 GMT+0000 (Coordinated Universal Time)

Saved by @dphillips #wordpress #database #credentials #automate

WPDBNAME=`cat wp-config.php | grep DB_NAME | cut -d \' -f 4`
WPDBUSER=`cat wp-config.php | grep DB_USER | cut -d \' -f 4`
WPDBPASS=`cat wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`
content_copyCOPY

https://stackoverflow.com/questions/7586995/read-variables-from-wp-config-php