This is technically challenging. WordPress must have access to your DB password in plain text. Having access to the wp-config.php
contents is already a breach of security in progress.
There are alternate approaches to configuration, such as loading credentials via environment variables, but in practice they are used exceedingly rarely because PHP’s configuration file is a reasonable solution already.
It’s not clear why you assume someone will get access to the configuration file. As a low-hanging fruit, you can place it outside of the web accessible directory. WordPress will scan for the configuration file up one directory level above itself. For subdirectory installs, you could use require
to load configuration content from elsewhere, but even that is rarely done.
Related Posts:
- how to encyrpt DB_PASSWORD in wp-config
- spambot registering without providing email or password, bypassing registration process
- Rename a table in MySQL
- How should I tackle –secure-file-priv in MySQL?
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user ‘root’@’localhost'(using password:YES)
- Using wpdb to connect to a separate database
- Checking if Database Table exists
- The MySQL alternatives: Do Percona Server and MariaDB work well with WordPress, and do they make WordPress go better?
- How to fetch Data in WordPress using MySQLi or $wpdb
- Connect to database using wordpress wp-config file
- wpdb->insert multiple record at once
- How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?
- How to define composite keys with dbDelta()
- Is sanitize_text_field() is enough to save to DB?
- Is it possible to define two databases for one installation?
- WordPress for a very large website
- WooCommerce with thousands of products – site is very slow – optimize db queries? [closed]
- “MySQL server has gone away” since update to 3.8
- Error establishing a database connection – with Debug Data
- Using two different DB users on one WP install
- How to execute mulitple statement SQL queries using $wpdb->query?
- Is $wpdb->prepare escaping to much? How to use it properly?
- Can I transfer a mysql database to another site?
- Database with mixed collation (utf8mb4 & utf8_general_ci)
- MySQL Syntax Error upon restoring database from backup [closed]
- Help running a MySQL query to update all wp_#_options tables in a Multisite install
- How to verify password outside WordPress?
- Set Display Name to first and last name (phpmyadmin SQL Query)
- Is it safe to convert tables from MyISAM to InnoDB?
- Emojis getting converted to “?”
- Migrating database / content of non-CMS site to WordPress
- Does WordPress ever need multiple databases?
- Why are no posts showing despite my apparently correct DB restoration?
- Delete all post meta except featured image Using SQL
- Who is responsible for data sanitization in WordPress development?
- wpdb_prepare with multiple or condition
- Adding new row to wp_post table
- WordPress Install and Database on separate hosting?
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- How do I get the posts within a certain year/date(with sql query)?
- Error establishing database connection – high traffic?
- Using GROUP CONCAT in my-sql query with wp_usermeta table
- Create table from array with prepare
- WordPress and user security
- How to prevent/delay MySQL connections when an object cache is used?
- Migrating from PDO using SQLite to clean new install using MySQL
- Call to undefined function get_user_meta() – trying to access data in MySQL from custom fields
- Convert user passwords to MD5?
- Duplicated site isn’t recognized as a site
- What can I do when an outside party hacks into my weblog and changes my display name?
- Have working sql query… trying to adjust it to use $wpdb
- Error establishing a database connection,
- Changing root password in PHPMyAdmin for WordPress Database when going live
- How to properly check if a table exists in WordPress Database using Show Tables Query
- Can’t update WordFence Options, clear data manually
- creating new field on mysql
- Is it possible to rebuild the website while not accesseing the original database?
- How and where is wordpress adding mySQL content to database?
- SQL query to set posts in bulk based on the post content
- How can I detect right db type?
- How to create more than one new wpdb object?
- Files on Localhost, Database on Server
- Remote database -> massive response time increase?
- Second ezSQL initialization for MSSQL
- Fetch a single row from a custom table for to a given ID
- Database create or redirect
- Getting “Error Establishing a Database Connection” on localhost in new Mac OSX Lion environment
- Secure way to use name_save_pre?
- WordPress Database – wp_usermeta and the correct number of session_tokens rows
- How to escape percentage sign(%) in sql query with $wpdb->prepare?
- DB prefix not updating
- Recovery – Restore Database after moving folder location locally
- Migrate Users From laravel to wordpress
- Replacing javascript link in WordPress database without getting mysql syntax errors
- How to edit custom table data in frontend
- local wordpress broke after changing URL
- how to access 2nd Mysqli Database from different server for wordpress
- Error establishing a database connection – WordPress setup, everything else is working
- How to map data on CSV to web pages?
- How to create index (sql) to a meta_key?
- Search and Replace in Windows XAMPP site
- WPCLI search and replace in a particlar site dir effect another site-dir
- How can i syn wordpress user table with a stand-alone php script?
- insert data from a form:: Warning Empty query mysqli::query()
- How can I get $wpdb to show MySQL warnings?
- WordPress Database Posts Table query
- Hang Up Followed By Can’t select database
- How to extract some part of WordPress full source code
- Mysql Queries per Visit – Crazy High
- Hash user emails in database?
- Why is converting my database to UTF-8 truncating entries?
- using same mysql user with many databases
- Why are my WordPress post queries so slow?
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- Recover Same WordPress Admin Password
- Custom wordpress SQL statement for a website
- How do I find users by password?
- How to find fresh (last modified) and sql backup?
- How to protect my credentials on my clients website