I changed my password and username for mySQL and I need to replace the connection string in all of my PHP scripts accordingly.
I am having trouble with the command because many of my php file names contain spaces.
What can I change to make this command work without having "No such file or directory" errors?
Here is the command I am using:
pattern='mysql_connect("localhost", "olduser", "oldpwd")' replacement='mysql_connect("localhost", "newuser", "newpwd")' find . -name "*.php" | xargs -n 1 sed -i -e 's|$pattern|$replacement|g'
I am unfamiliar with xargs and sed and I copied this code from this answer to a similar question.
(I think I will put the mysql_connect statement into a php include file and only change it in one place next time.)
I'm running Ubuntu 14.04 LTS using BASH