+------+-----------------------+
| user | host |
+------+-----------------------+
| root | 127.0.0.1 |
| root | localhost.localdomain |
+------+-----------------------+
mysql>update user set host='条件' where user='root';
例如:允许所有的计算机访问,那么设置host='%';
只允许ip号为192.168.1.231操作数据库 那么设置host='192.168.1.231'
我这里设置所有的计算机都能远程操作数据库
mysql>update user set host='%' where user='root'
+------+-----------------------+
| user | host |
+------+-----------------------+
| root | % |
| root | 127.0.0.1 |
| root | localhost.localdomain |
+------+-----------------------+接下来实现远程连接mysql了,
假设mysql服务器安装在一台linux系统上,该计算机ip:192.168.1.145
那么 打开另一台电脑,cmd
C:\Documents and Settings\Administrator>mysql -h192.168.1.145 -uroot -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 113 to server version: 5.1.49-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
OK了!
当然我这是以root用户为例,实际情况可能要设置其他用户,授权等等。
分享到:
2010-08-23 14:34
浏览 645
分类:数据库
评论