Access MySQL from external host: mysql -h ip u root -p

After logging in as root, check the registered users and register additional external IP addresses.

Connect to database, mysql -u root -p
-u: specify a user option
-u root: meaning like “by root user”
-p: login with password option

-Add an external IP address
Configure John user to access xxxdb from 192.168.1.*.

mysql> grant all privileges on xxxdb.* to john@”192.168.1.%” identified by ‘hoge’ with grant option;

How to login from an external host
$ mysql -h 192.168.1.12 -u John -p
port number: 3306 is running.
If it can not connect, check TCP Wrapper and IP tables.

How to login by specifying a database:
$ mysql -h 192.168.1.12 dbname -u John -p

To specify a port from an external host and login
$ mysql -h 192.168.1.12 –port=3307 -u John -p
When connecting to a MySQL server whose port number is set other than 3306, also specify the port number.