远程连接mysql数据库时可以使用以下指令
mysql -h 192.168.1.104 -u root -p
如果是初次安装mysql,需要将所有/etc/mysql/内的所有配置文件的bind-address=127.0.0.1全都注释掉
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port =
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
如果不配置的话会出ERROR 2003 (HY000): Can't connect to MySQL server on 'ip address' (111)故障。