要完成windows上的客户端访问centos上的mysql,,就需要做到两点:关闭centos上防火墙;赋予数据库用户远程访问的权限,并清除权限的缓存,具体配置如下:
[root@mysql ~]# service iptables stop
iptables: flushing firewall rules: [ ok ]
iptables: setting chains to policy accept: filter [ ok ]
iptables: unloading modules: [ ok ]
[root@mysql ~]# mysql -uroot -proot
error 1045 (28000): access denied for user'root'@'localhost'(using password:
[root@mysql ~]# mysql
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 4
server version: 5.1.66 source distribution
copyright (c) 2000, 2012, oracle and/or its affiliates. all rights reserved.
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
mysql> set password=password('rootroot');
query ok, 0 rows affected (0.00 sec)
mysql> quit
bye
[root@mysql ~]# mysql -uroot -p
enter password:
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 6
server version: 5.1.66 source distribution
copyright (c) 2000, 2012, oracle and/or its affiliates. all rights reserved.
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
mysql> quit
bye
[root@mysql ~]# mysql -uroot -p
enter password:
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 11
server version: 5.1.66 source distribution
copyright (c) 2000, 2012, oracle and/or its affiliates. all rights reserved.
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
mysql> grant all on *.* to'root'@'%'identified by 'rootroot';
query ok, 0 rows affected (0.00 sec)
mysql> flush privileges;
query ok, 0 rows affected (0.00 sec)
mysql>
