Remote settings of MySQL Databases in Linux
1. Start the service and log on
[Root @ localhost ~] #/Etc/init. d/mysqld restart
Stopping mysqld: [OK]
Starting mysqld: [OK]
[Root @ localhost ~] # Mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 2
Server version: 5.1.66 Source distribution
Copyright (c) 2000,201 2, 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>
2. Authorize a user who can log on remotely
Mysql> grant all privileges on *. * to tong @ '%' identified by 'system'; -- create a remote user
Query OK, 0 rows affected (0.00 sec)
Mysql> flush privileges; -- Update permission
Query OK, 0 rows affected (0.00 sec)
Mysql>
3. Disable the Firewall
[Root @ localhost ~] #/Etc/init. d/iptables stop
Iptables: Flushing firewall rules: [OK]
Iptables: Setting chains to policy ACCEPT: filter [OK]
Iptables: Unloading modules: [OK]
[Root @ localhost ~] #
4. You can log on with the client tool.
C: \ Users \ Administrator> mysql-h remote IP-u tong-p -- tong is the remote user name
Enter password :******
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 32
Server version: 5.5.19 MySQL Community Server (GPL)
Copyright (c) 2000,201 1, 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>
Error handling:
(1) The firewall is not closed or the firewall does not filter port 3306.
Figure:
Solution:
[Root @ localhost ~] #/Etc/init. d/iptables stop
Iptables: Flushing firewall rules: [OK]
Iptables: Setting chains to policy ACCEPT: filter [OK]
Iptables: Unloading modules: [OK]
[Root @ localhost ~] #
Or:
[Root @ localhost ~] # Vim/etc/sysconfig/iptables -- Add the following line
-A input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT
(2) Incorrect password
Figure:
Solution: enter the correct password. If the password is forgotten, modify it in the server system.
Installation and remote settings of MySQL in Linux