I am aware of WP-CLI's many database interaction functions via "wp db" and its functions for generating wp-config files via "wp config" - However I cannot find a way of using WP-CLI to modify existing database name, username and password settings in wp-config.
I am migrating multiple sites, and the ability to do this would be a time saver.
I am aware that wp config can launch vi editor (wp config edit), but I am looking for a way to pass the database name, username and password TO WP-CLI to have it do the job for me. Possible?
The
wp configsubcommand can alter yourwp-config.phpfile without trying to fire up the whole WordPress stack or open the database. So you could change, for example, your DB_HOST like so.It works for any
define()in your config file.It takes four of these
setcommands to modify host, database, user, and password, of course.