1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Can I host wordpress database in an other server?

Discussion in 'Databases' started by hungvn9, Jan 12, 2014.

  1. #1
    Hi,

    I wonder if we can host wordpress database (mysql) in an other server which is not the server storing the content (source code, uploads files, plugins, theme...)
    Will that make any performance and security improvement? Is there any service specialized in hosting only database?
    SEMrush
    Thanks,
     
    Last edited: Jan 12, 2014
    hungvn9, Jan 12, 2014 IP
    SEMrush
  2. suvidha.writer

    suvidha.writer Active Member

    Messages:
    75
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Yes, as long as the MySQL server allows the database to be accessed by external servers.
    When you set up WP, instead of "localhost", you'll put in the SQL server.
     
    suvidha.writer, Jan 12, 2014 IP
  3. hungvn9

    hungvn9 Member

    Messages:
    179
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #3
    Thanks, what if I already installed wordpress before and want to move the database?
    There are still some concerns that I need your help
     
    hungvn9, Jan 12, 2014 IP
  4. sundaybrew

    sundaybrew Numerati

    Messages:
    7,299
    Likes Received:
    1,258
    Best Answers:
    0
    Trophy Points:
    560
    #4
    Yes, you can export the current database, then you will create a database on another server,

    then instead of "localhost" (in the config.php ) you will put the IP address of the server and then the config.php will connect :)
     
    sundaybrew, Jan 12, 2014 IP
  5. khodem

    khodem Member

    Messages:
    201
    Likes Received:
    5
    Best Answers:
    3
    Trophy Points:
    45
    #5
    well this is not good idea unless your Wordpress source file and your database are in the same network... what I mean is if you host your database in different network and your source in different network there would be a lot of latency... as when someone access your site the source files have to access database across internet to put out the information and sometimes access this through internet is bad bad idea
     
    khodem, Jan 24, 2014 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,448
    Likes Received:
    685
    Best Answers:
    147
    Trophy Points:
    420
    #6
    You won't get any performance boosts from this, unless you're having a LOT of traffic, separate hosting/caching/sql-servers, and running each on a separate server within a fiber-cable-setup or at least GB-local network - there is NO real point in running this on separate servers, unless you're running this on a poorly configured shared-hosting server - then you might get a slight improvement by running the SQL on a separate server, but yet again, only if it's on a local node. Going through the Internet for this is NOT recommended. Also, remember that if you go through the Internet, this will be pulled from any traffic-charges (bandwidth) you have.
     
    PoPSiCLe, Jan 31, 2014 IP
  7. HalfDedi

    HalfDedi Greenhorn

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    8
    #7
    this only good if both web server and database server are in the same network or better in a private LAN configuration as it will have little ping time and secure (data are not transferred via internet connection)
     
    HalfDedi, Jan 31, 2014 IP
  8. hip_hop_x

    hip_hop_x Active Member

    Messages:
    522
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #8
    Well in case you got plenty of visitors it's worth using a dedicated/vps just for your sql db, and separate http from db. And even more in future it will be better to use clusters for http and db.
     
    hip_hop_x, Feb 4, 2014 IP
  9. phptechie

    phptechie Well-Known Member

    Messages:
    855
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    100
    #9
    As said by others , its not advisable to have them separately.
    One other reason is that , if the server that has the database fails or shuts down , then the website files will not be able to access the database & so your site will not display to the end user.
    Also bandwidth will be different for these 2 servers , which will also add pain when you have more visitors / traffic at any point in time.

    Last but not least , when you upgrade php versions & mysql versions , you have to do it on both the servers , which will be time consuming & cost you more money.

    So the best option would be to move onto a dedicated server hosting both the source files & database on the same server , this will be bit easier for you to update/manage the server in future.

    Hope this helps :)
     
    phptechie, Mar 3, 2014 IP
  10. Brands-and-Jingles

    Brands-and-Jingles Member

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #10
    
    
    // wp-config.php
    
    define ( 'DB_NAME', 'yourdbname' );
    define ( 'DB_USER', 'yourusername' );
    define ( 'DB_PASSWORD', 'yourpassword' );
    define ( 'DB_HOST', '111.222.0.1' ); // IP address of the server where MySQL is running 
    
    // make sure MySQL server will listen to the request from your WP server IP !
    
    
    Code (markup):
     
    Brands-and-Jingles, Mar 20, 2014 IP
  11. buythiscomputer

    buythiscomputer Greenhorn

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #11

    hello, so it's always better to host database + files on the same server ?

    Thanks.
     
    buythiscomputer, May 14, 2017 IP
  12. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,448
    Likes Received:
    685
    Best Answers:
    147
    Trophy Points:
    420
    #12
    No. Not necessarily. Same NETWORK. If you have a GB-connection between the file-server and the db-server, you're pretty good. If you have a 10GB connection, you're golden. If they're on different subnets, or different locations, or even worse, have no dedicated line between them, you're gonna have latency issues, packet drops and other problems.
     
    PoPSiCLe, May 15, 2017 IP
  13. webhost.uk.net

    webhost.uk.net Active Member

    Messages:
    238
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #13
    Right, infact a separate mysql and webserver will improve speed and performance ,we have done such clustered solutions for few of our customers.
     
    webhost.uk.net, May 16, 2017 IP
  14. buythiscomputer

    buythiscomputer Greenhorn

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #14
    can you explain me why separate mysql and files server can improve ? if you have only 1 server but very powerful and with lots of RAM, wouldn't it be better ?
     
    buythiscomputer, May 16, 2017 IP
  15. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,448
    Likes Received:
    685
    Best Answers:
    147
    Trophy Points:
    420
    #15
    Depending on what you need, and how much load you put on both the webserver and/or DB-server, there is just so much you can do with one server, before the cost is becoming prohibitive. By dividing it up, you have separate servers doing the work only for what they host. 20000 user on your webserver? Not that big a problem. 20000 users using the database? Not a big problem. Having 40000 users on the same server, using both the webserver and the db-server might be harder - also, take note that these numbers are just arbitrarty numbers used to prove the point. Depending on your specific server-setup, the number might be lower, or it might be higher.
     
    PoPSiCLe, May 16, 2017 IP
  16. webhost.uk.net

    webhost.uk.net Active Member

    Messages:
    238
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #16
    If you keep webserver and mysql access separate , may server process will be divide , and CPU usage of the server will also be divide in this case. A single server when handles all the process it will affect the performance.
     
    webhost.uk.net, May 17, 2017 IP