Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7736635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:47:21+00:00 2026-06-01T07:47:21+00:00

I currently run an Rails app on a single VPS with it’s own MySQL

  • 0

I currently run an Rails app on a single VPS with it’s own MySQL database. This database also contains the users table. We are currently building a second application which should have the same users. If one registers for either, he has an account for both.

However, the problem is that this second (PHP) application must be hosting at another location. What are the best practices here? Can I directly connect to the external database without causing a big delay? Should I sync them? Create a API at the first?

I’m searching for the most maintainable method possible. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:47:22+00:00Added an answer on June 1, 2026 at 7:47 am

    You can allow the second host access to the first MySQL server. The best practices (as far as I’m aware) to do this would be to create a new user account, give it the required privileges to the users table, only allow access to it from the IP or domain of the second host and using a secure password. You would run this query on the MySQL server:

    GRANT ALL ON mydatabase.users TO 'mynewuser'@'123.123.123.123'
        IDENTIFIED BY 'mysecurepassword';
    

    Needless to say you would replace ‘mydatabase.users’ with your database and table name, ‘mynewuser’ with the username of the user you want to have access (you can put anything here, the user will be automatically created), ‘123.123.123.123’ with the IP or domain name of your second server and ‘mysecurepassword’ with a good and long password, preferably randomly generated.

    Your second server would now be able to connect to the MySQL server and have ALL privileges (you can change that to what ever privileges it needs) on the mydatabase.users table.

    MySQL 5.6 GRANT Syntax
    Greensql.com on MySQL remote access best practices

    To minimize the small performance penalty I would refrain from creating multiple MySQL connections (Try to use as few as possible, preferably just one). I’m not 100% on the following, but I’m pretty sure it would be a great idea to reduce the amount of separate queries you execute as well. Instead of running 10 separate inserts, run one insert with multiple VALUES segments, e.g.

    INSERT INTO mytable(id, name) VALUES
        (0, 'mia'),
        (1,'tom'),
        (2,'carl');
    

    I’m sure MySQL Prepared Statements would also be of considerable help reducing the speed penalty

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to run a LINQ query over a MS SQL database. This
I want to run an instance of wordpress within my rails app. I currently
I'm currently on Dreamhost attempting to run a Rails 2.3.5 app. Here is the
I currently run my Rails app using: jruby --1.9 -J-XX:+CMSClassUnloadingEnabled -J-XX:+UseConcMarkSweepGC -J-XX:MaxPermSize=256m -S rails
Currently I run a web app that heavily relies on short URLs that link
I am currently investigating using the selenium-on-rails plug-in for testing an upcoming web app
I am attempting to run my rails app using Passenger and Apache. As far
I have a rails app where I have clusters and users in a belongs_to
I'm currently trying to get a Mongo database running alongside Devise. I'm using Rails
I'm using a jquery-ui datepicker in a Rails 3 app. The datepicker is currently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.