Databases Reference
In-Depth Information
ruttle.invyhome.com (192.168.1.2)
Network
Database server software
toorak.invyhome.com (192.168.1.4)
yazd.invyhome.com (192.168.1.6)
Figure 9-5. A simple home network with three computers, and one MySQL server
Creating a New Remote User
If you want to allow a user to connect to the server from another computer, you must
specify the host from which they can do so (the remote client). Suppose that you have
a home network, that your machine has the private IP address 192.168.1.2, that your
home domain is
invyhome.com
, and that your machine is named
ruttle
(that is, its
complete name is
ruttle.invyhome.com
). Let's also assume that you're running a
MySQL server on
ruttle
, and that there are two other machines on the network:
toorak.invyhome.com
with the IP address 192.168.1.4 and
yazd.invyhome.com
with IP
address 192.168.1.6.
Figure 9-5 illustrates this setup. Again, we differentiate between user accounts on the
MySQL server (
MySQL users
or
MySQL accounts
) and user accounts on the host ma-
chines (
system users
or
system accounts
).
Now, let's consider the MySQL setup on
ruttle
. Let's assume you've previously logged
in to the MySQL server on
ruttle
as the
root
user and created the user
hugh
with the
statement:
mysql>
GRANT ALL on *.* TO 'hugh'@'localhost' IDENTIFIED BY '
the_password
';
Query OK, 0 rows affected (0.00 sec)
If you're logged in to your system account on
ruttle
, you can connect to the MySQL
server on
ruttle
using the following:
$
mysql --host=localhost --user=hugh --password=
the_password