@soderlind I actually sorted this out mostly. I installed a local mysql and got rid of any other mysql installs or apps that had it running. I now have wordmove using my local installs mysqldump, but when it runs I get this error:
mysqldump: Got error: 1049: Unknown database ‘local’ when selecting the database
Make sure you have the same database prefix as the remote site.
Be sure to have all the dependencies required to make WordMove work. That includes having mysql installed in the system and having its executable in your path with the proper permissions. I had to manually add the mysqldump executable to my path. For this, after I installed MySQL in my system, I created a symbolic link (ln -s) from /usr/local/bin/mysqldump to /usr/local/mysql/bin/mysqldump.
In the Movefile, in the remote (or production or however you call it) environment, I specified the database host as the IP that Local gives you in the Database tab of the site you created in the GUI.
I installed wp cli in my system and changed the sql_adapter line in the Movefile from ‘default’ to ‘wpcli’.
Finally, in the wp-config.php I changed the localhost in the "define( ‘DB_HOST’, ‘localhost’) " line for the same IP that Local gives you in the Database tab in GUI and added the port number at then end. It lookes like this:
define(‘DB_HOST’, ‘192.168.90.200:4002’). We need to make that change or wp-cli won’t be able to connect to the database and replace the urls automatically. In my case, I still had to change the siteurl value manually in the database but that was easy.
After all this, I was able to successfully pull the database with WordMove. The last problem I got in was that wp-cli didn’t changed the siteurl value in the database, so when I tried to access the local domain it redirected me to the remote server and the browser cached this as a 301 redirect. So I had to erase that cache (is not the regular cache you can delete in the privacy settings) and, after also changing hte siteurl value directly in the database with Sequel Pro, I was finally able to visit the local environment.
Hello,
I am trying to pull a Database from production to local (flywheel) and i am not sure how to deal with the database. It’s not finding the mysql database ( local
mysqldump: Got error: 2002: Can’t connect to local MySQL server through socket). Is there a fix ?
Any pointers would be great ! Thanks
I don’t know what Local by Flywheel does to host the MySQL section of these WordPress installs, but I have my own solution with wordmove and I hope other are able to get help with this.
So turns out that for me it’s just impossible to get wordmove to work with primarily the database section… here is a trick to get something.
Assuming all your credentials are correct. Go ahead and do a wordmove push --all. After like 3-4 minutes it will be successful everywhere BUT the database section. Let that be.
Now go to local by flywheel and go to the database of the site you are converting. Click on “Adminer” to open up the database. On the left hand side click on Export.
Make sure that the option is selected as save rather thanopen. At the top you will see a section on the table calledDATABASE. Leave blank. Under tables select the optionDROP + CREATE`. This looks sketch but your local database will be fine. Usually PHPmyadmin is annoying if there is a table that already exists.
Go to your PHPmyadmin in your server and import the file that was just created.
After that go to the wp_options table and replace the url’s of your old site to the new one. Wordmove does this for you if you were able to get the database to work but hey, you are reading this for a reason aren’t you?
Your site should be live. It’s not the most convenient way to do this but beggars can’t be choosers I guess.
Hi @soderlind, does this still work? I tried gem install wordmove and my terminal says gem: command not found. In fact, ruby isn’t available on my local site at all. @clay can you confirm that is the case?
I’m thinking I might need to install ruby inside my local site. Before I go down this rabbit hole, is that the right thing to do?
wget -O ruby-install-0.7.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.7.0.tar.gz
tar -xzvf ruby-install-0.7.0.tar.gz
cd ruby-install-0.7.0/
make install
List supported Rubies and their major versions
ruby-install
Install ruby 2.4.x (was 2.4.7 when I wrote this) in /usr/local
ruby-install --system ruby 2.4.7
Log out of the terminal and ssh into it again
You’ll now have the prerequisites to install WordMove