In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Experimental environment:
Operating system: Redhat 6.4IP:10.1.1.99 (virtual machine)
Database: MYSQL5.1
After installing MYSQL on Linux, log in locally
[root@wjq2] # mysql-uroot-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 10
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 >
Log in successfully
The following is an analysis of the problems encountered in remotely connecting to the MYSQL server through the SQLyog client:
Question 1:
Problem analysis:
[root@wjq2 ~] # service mysqld status
Mysqld (pid 2364) is running...
[root@wjq2 ~] # netstat-nalp | grep "3306"
Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 2364/mysqld
Tcp 0 0 10.1.1.99:3306 10.1.1.123:55569 ESTABLISHED 2364/mysqld
Tcp 0 0 10.1.1.99:3306 10.1.1.123:55568 ESTABLISHED 2364/mysqld
Local users can use port 3306 to connect, indicating that there is no problem with the network, and port 3306 is also open. In fact, the problem may lie in iptables. Check the running status of iptables.
[root@wjq2 ~] # service iptables status
Iptables: Firewall is not running.
It is found that iptables is disabled, so the problem is not with iptables.
Note:
1. If your iptables is not disabled, you can disable iptables
2. If you don't want to disable iptables, add-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT to / etc/sysconfig/iptables, which means port 3306 is allowed to pass through the firewall.
[root@wjq2 ~] # cat / etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
* filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
-An INPUT-m state-- state ESTABLISHED,RELATED-j ACCEPT
-An INPUT-p icmp-j ACCEPT
-An INPUT-I lo-j ACCEPT
-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 22-j ACCEPT
-An INPUT-j REJECT-- reject-with icmp-host-prohibited
-A FORWARD-j REJECT-- reject-with icmp-host-prohibited
-A RH-Firewall-1-INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT
COMMIT
After the modification, you need to restart iptables to take effect.
After disabling iptables or modifying the configuration file, connect to MYSQL remotely again, and the following error occurs:
Question 2:
Problem analysis:
According to the error prompt, 10.1.1.123 is the network card IP of my local host, and it is not allowed to connect to the MYSQL server through this host when connecting remotely. It may be due to lack of permissions.
Next I will allow the user root to connect to the MYSQL server from any host using the password XXX
Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' XXX' WITH GRANT OPTION
Query OK, 0 rows affected (0.00 sec)
Or allow user root to connect to the MYSQL server from a host with an IP of 10.1.1.123 and use XXX as the login password
Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'10.1.1.123' IDENTIFIED BY' XXX' WITH GRANT OPTION
Query OK, 0 rows affected (0.00 sec)
After the authorization is successful, try to connect remotely again, and you can find that the connection is successful
Author: SEian.G (hard practice changes in 72, but it is difficult to laugh at 81)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.