WordPress.org

Ready to get started?Download WordPress

Forums

Accessing my Local Host on 2 Computers via Drop Box (10 posts)

  1. kabbashdesign
    Member
    Posted 1 year ago #

    I have my MAMP_Docs in my Drop Box and can access it on my laptop but am unable to access it on my iMac.
    I have checked the preferences and they are identical to what i have n my laptop.
    This is the message I am receiving:

    We were able to connect to the database server (which means your username and password is okay) but not able to select the MAMP_Docs database.

    Are you sure it exists?
    Does the user root have permission to use the MAMP_Docs database?
    On some systems the name of your database is prefixed with your username, so it would be like username_MAMP_Docs. Could that be the problem?
    If you don't know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.

  2. Paul Clark
    Member
    Posted 1 year ago #

    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

  3. kabbashdesign
    Member
    Posted 1 year ago #

    Thank you and sorry about the double post.
    Tom

  4. kabbashdesign
    Member
    Posted 1 year ago #

    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

  5. Paul Clark
    Member
    Posted 1 year ago #

    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

  6. michael.mariart
    Member
    Posted 1 year ago #

    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.

  7. Paul Clark
    Member
    Posted 1 year ago #

    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.

  8. michael.mariart
    Member
    Posted 1 year ago #

    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.

  9. Paul Clark
    Member
    Posted 1 year ago #

    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.

  10. fonglh
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic