Results 1 to 16 of 16
  1. #1

    How do I setup a site on 2 servers. 1 for mysql 1 for web?

    Hello,

    How do I setup a site to use two servers? One as a mysql server and the other as a web server.

    At the moment I have the site on one server. When I get the second server what steps do I need to take to make this possible?

    How do I secure the mysql server to only allow the web server to connect to it?

    Do I need a control panel (i.e. cPanel) software on the mysql server?

    Thank you for your time.

  2. #2
    Join Date
    Jun 2008
    Location
    UK
    Posts
    266
    well there's a lot of different ways - you don't need a control panel if you don't want one - having said that, some panels like whm let you set up a seperate mysql server very easily.

    securing the mysql server would be done through it's firewall - ie you'd only allow mysql connections from the web servers IP address.
    WebCertain - SEO, PPC, PR - The services you need to increase your site traffic. Specialists in over 35 languages and country-specific SEO! www.webcertain.com

  3. #3
    webcertain,

    I just noticed WHM has the option to setup a seperate mysql server.

    Now, after I have my new server, with the OS and mysql server software how do I setup the database on that server?

    Thanks.

  4. #4
    Join Date
    Jun 2008
    Location
    UK
    Posts
    266
    well, you either ssh in and use the mysql command line, or you get yourself a mysql client (or sometihng like phpmyadmin installed on the server), to manage the database(s) with.
    WebCertain - SEO, PPC, PR - The services you need to increase your site traffic. Specialists in over 35 languages and country-specific SEO! www.webcertain.com

  5. #5
    OK got it. Thanks!

    Any other/better mysql clients than phpmyadmin?

  6. #6
    Join Date
    Oct 2006
    Location
    India
    Posts
    62
    Hi,

    As per my experience phpmyadmin is the best available app to manage your mysql databases. Simple and effective.

    Once you have done with your db server, make sure that you allow access to only those users which are requesting connections from your web server. And, howto grant access to remote users to your mysql db is clearly defined over here : http://www.crazyadmins.com/forum/viewtopic.php?f=4&t=16

    I hope this will be helpful for you in configuring things.
    Sony Koithara ,
    CrazyAdmins.com
    -> where admins go c r @ z y!!!

  7. #7
    koithara,

    Yes I think that will come in handy. Thanks!

  8. #8
    Join Date
    Jul 2009
    Location
    SLASH ROOT
    Posts
    26
    Make sure your code on the webserver is directed to the MySQL DBs you will be putting the second server. On securing the MySQL server, you will have to allow remote connections. This being said, you could allow only connections to come in from your webserver(specifically from a single IP address even).

    Further block all ports on the MySQL server, while allowing only the one that it listens on(by default this would be 3306). This could be done on any firewall.

    ---------------------------
    Sr.Systems Engineer
    WHRSS
    We grow by helping you grow

  9. #9
    Quote Originally Posted by webcertain View Post
    well, you either ssh in and use the mysql command line, or you get yourself a mysql client (or sometihng like phpmyadmin installed on the server), to manage the database(s) with.
    webcertain,

    One question about your suggestion about phpmyadmin. I already have phpmyadmin on the webserver. Did you mean I should install it on the mysql server as well? Thanks!

    Quote Originally Posted by whrss2 View Post
    Make sure your code on the webserver is directed to the MySQL DBs you will be putting the second server. On securing the MySQL server, you will have to allow remote connections. This being said, you could allow only connections to come in from your webserver(specifically from a single IP address even).

    Further block all ports on the MySQL server, while allowing only the one that it listens on(by default this would be 3306). This could be done on any firewall.

    ---------------------------
    Sr.Systems Engineer
    WHRSS
    We grow by helping you grow
    whrss2,

    Thank you for your help! How do I allow connections to the mysql server only from the IP of the webserver?

    Thanks again.

  10. #10
    Join Date
    Oct 2006
    Location
    India
    Posts
    62
    you are welcome...
    Sony Koithara ,
    CrazyAdmins.com
    -> where admins go c r @ z y!!!

  11. #11
    Join Date
    Jul 2009
    Location
    SLASH ROOT
    Posts
    26
    You can allow remote connections on the MySQL server by using the following commands :
    -------------------------
    These edits are to be made on the MySQL configuration file : /etc/my.cnf

    Make sure this line is commented/removed :
    # skip-networking

    Modify the line :
    bind-address=the_database_server_ipaddress
    -------------------------

    Now log into MySQl as the super user.
    -------------------------------
    $ /etc/init.d/mysql restart
    $ mysql -u root -p

    If you want to grant access to a new database :

    mysql> CREATE DATABASE new_DB;
    mysql> GRANT ALL ON new_DB.* TO *@'webserver_IPaddress' IDENTIFIED BY 'PASSWORD';

    If you want to grant access to an existing database :

    mysql> update db set Host='webserver_IPaddress' where Db='exist_DB';
    mysql> update user set Host='webserver_IPaddress' where user='exist_DB_user';
    OR

    Grant access to all users from the webserver to all databases :

    mysql> GRANT ALL ON *.* TO *@'webserver_IPaddress' IDENTIFIED BY 'PASSWORD';
    -------------------------------

    Now allow remote connections from only your web server located at "webserver_IPaddress"
    --------------------------------
    iptables -A INPUT -i eth0 -s webserver_IPaddress -p tcp --destination-port 3306 -j ACCEPT

    iptables -A INPUT -s your_ipaddress -p tcp --dport 22 -j ACCEPT <--This is to allow you SSH access.

    iptables -A INPUT -j DROP <----This would block all access to the server(Caution!!!)
    --------------------------------

    Hope this helps out.
    ----------------------------
    Sr. Systems Engineer
    WHRSS
    We grow by helping you grow.

  12. #12
    Is apache required on the mysql server?

  13. #13
    Quote Originally Posted by ToroPreto View Post
    Is apache required on the mysql server?
    No. It would be recommended to keep everything to a bare minimum if you're just using the second server for MySQL.
    478east
    High Bandwidth Servers
    Custom Hosting Solutions

  14. #14
    Quote Originally Posted by cristibighea View Post
    No. It would be recommended to keep everything to a bare minimum if you're just using the second server for MySQL.
    Thank you. Where do I put the database on the mysql server?

  15. #15
    Thanks to everyone for their replys. The user eth1 has taken care of this and he receives my recommendation.

  16. #16
    Join Date
    Mar 2009
    Posts
    254
    Quote Originally Posted by ToroPreto View Post
    Thank you. Where do I put the database on the mysql server?
    Upload your database onto the new server and use SSH to write the database to mysql with this command
    mysql -u username -p password dbname < databasefile.sql

Similar Threads

  1. Synchronizing MySQL powered site across 2 dedicated servers
    By nemomaritime in forum Hosting Security and Technology
    Replies: 11
    Last Post: 11-20-2008, 06:24 PM
  2. How many servers needed for a php/mysql site with 1million page views a day
    By jmakhan in forum Hosting Security and Technology
    Replies: 11
    Last Post: 05-31-2008, 04:31 AM
  3. Replies: 5
    Last Post: 10-01-2005, 02:07 PM
  4. Looking to setup new site, new to servers also...
    By VilleValo in forum Dedicated Server
    Replies: 4
    Last Post: 12-26-2004, 11:59 PM
  5. Replies: 6
    Last Post: 10-26-2003, 10:31 AM

Posting Permissions

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