Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Linux/Run SQL in Bash

March 10, 2019

Run SQL in Bash

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

Have content delivered to your mail. Subscribe below.

About Me

I'm Ulysses, Cloud Engineer at Cardinal Health based in Columbus. This blog is about Linux and Cloud technology. When off the grid, I enjoy riding the electric skateboard. I've surfed, snowboarded and played the saxophone in the past. I hope you will find this website helpful. It's powered by WordPress and hosted on AWS LightSail.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021