如何在ubuntu上将MySQL主机设置为“localhost”以外的其他东西?

I have two server bought and I have 2 real IP's. One for files and another for database. I setup mysql database to second server but I cannot connecting it from my first server because mysql hostname is localhost. How can I connect 2nd server database from first one?

Use the IP Address of the Database server as the host name

i.e

host = '192.168.1.10`;

you will of course also have to make sure you are using a MySQL user account that is allowed to login from your applcation servers ip address

  1. Go to your first server.

  2. give below command on first server-

    mysql -h server_ip -u myuser -p

Here server_ip means 2nd db server ip, myuser is a db user for 2nd server.

Now it will ask password so give your db server password for root user.

Note: Make sure myuser should have privileges on 2nd db server either from 1st server or should have global privileges.