• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Run SQL in Bash

March 10, 2019

Here’s an example on how to run MySQL commands from Bash.

mysql dbname -e "UPDATE wp_options SET option_value='http://domain.com' WHERE option_name='home'";
mysql dbname -e "UPDATE wp_options SET option_value='http://domain.com' WHERE option_name='siteurl'";

mysql dbname -e "UPDATE wp_options SET option_value='http://domain.com' WHERE option_name='home'"; mysql dbname -e "UPDATE wp_options SET option_value='http://domain.com' WHERE option_name='siteurl'";

The example updates WordPress’ home and siteurl. Script contains no password. It’s using .my.cnf config file.

Filed Under: Linux, WP Tagged With: .my.cnf, bash, mysql, sql, wordpress

Search This Website

Subscribe Via Email

  • Home
  • About
  • Archives

Copyright © 2023