SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Online MySQL Passwords

    I'm not ready to publish my MySQL tables online yet, but I hope to get there tomorrow or the next day. So I'd like to find an answer to a question that's been bugging me.

    I checked out my C-Panel and found the icon for creating a MySQL database. I created one, giving it a username and password. The username was hyphenated or linked by an underscore. I think it's a combination of my webhosting username and my another word that denotes my webhost.

    So, am I correct in assuming that I have to use the same username on my localhost sites? After all, if my webpage is connected to a MySQL database/recordset with the username rex, but I publish it to an online site where the MySQL database's username is rex_coolhost, then it obviously isn't going to work.

    That raises another question. Suppose I have a dozen websites, hosted by three different webhosts, and many will share the same databases. I assume my online MySQL databases will have to have three different usernames. Does that mean I have to make copies of my databases and given them three different usernames to use on my local websites?

    So if I revise my tables in a database named World, I have to make the same revisions in World2 and World3?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Your assumption is incorrect. Assuming the database allows outside connections (some hosts don't let you do this, and some simply require you add access hosts through their control panel), you can connect to it from all of your sites with one username and password pair, and all access the same database. You don't need to duplicate the databases or create users for each site.

  3. #3
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman
    Your assumption is incorrect. Assuming the database allows outside connections (some hosts don't let you do this, and some simply require you add access hosts through their control panel), you can connect to it from all of your sites with one username and password pair, and all access the same database. You don't need to duplicate the databases or create users for each site.
    OK, let me make sure I understand this. Suppose I have four websites hosted by two webhosts, as follows:

    GoodValue Webhost, Inc.
    www.geobop.org
    www.geoworld.org

    Linux Webhosting, Inc.
    www.politix.org
    www.edrevolt.org

    Let's say I put a MySQL database online with Linux Webhosting, and I wind up with username_linuxweb for a username. Are you saying that I can publish pages to Good Value Webhosts and link my pages to my databases with Linux Webhosting?

    And to make everything work on my local sites, I should log into the databases on my computer as username_linuxweb ,too?

    If so, that would make life a lot easier. On the other hand, if the webhost with the database crashes, I guess that pulls the plug on all my sites!

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes, if the host allows outside connections, you can run all four sites off that one database, as well as use it locally by connecting with the same username and password. And yes, by doing so all four sites would go down if the database went down.

    The major downside to doing this is that it takes longer for your sites to connect to the remote database than if it were on the same server as the site, which will slow down your site.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •