MAMP_Docs may be the name of the folder where you are holding your WordPress files, but it appears that it is also the name you gave your site database. The database is stored in MySQL. It is not a traditional file structure that can be synced over dropbox, and it not stored in the site files or MAMP_Docs folder.
Instead, you will need to use PHPMyAdmin to set up the database again on your new computer. You can export the old database to a file using the Export
and Import
tabs in PHPMyAdmin.
PHPMyAdmin can be found under MAMP > Open start page > PHPMyAdmin
or MAMP Pro > MySQL > Launch PHPMyAdmin
Thank you and sorry about the double post.
Tom
Another question for you.
So you are saying there is no way to have the host folder/Word Press folder in my Drop Box and be able to access it from my Laptop and iMac?
I put the folder in the Drop Box while working on my Laptop. I can still access the database on the laptop but not on my iMac.
So is there a way to set this up where I can work on the same database on two computers? I work on both equally.
I am not super tech savvy so a lot of this is very new to me.
Tom
You would either have to use PHPMyAdmin to export/import it as described, then sync the database dump (exported file) using dropbox, or use a database that is not on your local computer. For example, some hosting providers allow you to connect to their database remotely. In this case, you would have a remote address for DB_HOST
in wp-config.php
instead of localhost
.
For our own development company with many people working on sites in many places, we use database dumps stored in Git, which is similar to Dropbox. We use command line mysql
and mysqldump
instead of PHPMyAdmin to speed up imports and exports, but that’s about it.
For example, export database “wordpress” as user “USERNAME” to file db.sql:
mysqldump --add-drop-table wordpress -uUSERNAME -p > db.sql
Overwrite your current database with the contents of db.sql:
mysql wordpress -uUSERNAME -p < db.sql
Each will prompt you for your database password. You can avoid having to input the username or password by setting up .my.cnf. The linked example places .my.cnf
in /root
, but it can also be placed in your home directory, ~/.my.cnf
So is there a way to set this up where I can work on the same database on two computers? I work on both equally.
There’s actually more of a problem with doing this.
WordPress stores the sites URL in the database, and uses this for all of it’s internal links. It also uses this to hard-code any links that you add into your blog posts or pages.
So, if you have two installations working from the same database, one of them won’t use the right URL and will always be directing you to the other site. The only way around this is if you use the same URL on both PC’s at all times.
michael.mariart is correct that you should use the same URL for both local environments, but it is not the only way around it. You can also override the site URL in wp-config.php.
You can do that, but that still doesn’t solve the issue with hard-coded links in posts/pages. They will remain hard-coded to whichever URL you’re using when you add them, so they’ll always be wrong half the time – unless you want to go back end edit every one every time you change PC’s.
Right– the wp-config option shouldn’t be used if you plan on creating new posts with images in development, or if you don’t want to use a find-and-replace plugin to fix them later.
The URLs aren’t an issue if he’s using localhost.
@kabbashdesign Unfortunately there’s no easy way to do this. pdclark’s suggestion of using mysql and mysqldump is probably the easiest method.