Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Connecting PHP Web Server to MySQL database server

Discussion in 'Database Discussion' started by BHPR26, May 1, 2019.

  1. BHPR26

    BHPR26 Registered

    Joined:
    May 1, 2019
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    Hello,

    I have a web server running PHP and another server for database in the same data center connecting on the same rack. What is the correct way to connect PHP to database server to reduce latency and increase the speed?

    Webserver has Cpanel but should I have cpanel domain account for database as well? The database currently has WHM but no domains account for Cpanel

    Thank you
     
  2. GOT

    GOT Get Proactive! PartnerNOC

    Joined:
    Apr 8, 2003
    Messages:
    1,478
    Likes Received:
    185
    Trophy Points:
    193
    Location:
    Chesapeake, VA
    cPanel Access Level:
    DataCenter Provider
    You don't really NEED cpanel installed on the database server if all it is ever going to do is host databases, you can simply install your preferred version of MySQL on there and you can even have cPanel on the web server connect to it as an external database server using the Manage MySQL Profiles.

    If they are in the same rack, if possible I would use a private network connection between them instead of using the public interface.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. BHPR26

    BHPR26 Registered

    Joined:
    May 1, 2019
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Los Angeles
    cPanel Access Level:
    Root Administrator
    Any instruction on how to setup a private network connection?

    Thank you so much for your help!
     
  4. GOT

    GOT Get Proactive! PartnerNOC

    Joined:
    Apr 8, 2003
    Messages:
    1,478
    Likes Received:
    185
    Trophy Points:
    193
    Location:
    Chesapeake, VA
    cPanel Access Level:
    DataCenter Provider
    You would need to have two nice in the servers minimum and either a crossover cable installed between them or a separate switch set up to handle the private network
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,335
    Likes Received:
    2,162
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @BHPR26,

    Additionally, if it's just a single application that you want to use a remote MySQL database with, then you should not use WHM >> Manage MySQL Profiles to enable the remote MySQL server. That option is intended for administrators that want to store all of their MySQL databases on a remote server.

    If you only want to host an individual MySQL database on a remote server, you'd simply setup the database on the remote server and use the remote server's IP address as the database host name in your PHP script's configuration file. Then, browse to cPanel >> Remote MySQL and add the MySQL server's IP address as an access host.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice