Tag Archives: The internet

How to solve MySQL error 1049 (42000): unknown database ‘database’

In fact, I made a very serious mistake, and this mistake can only be reported for two reasons.
Reason 1: There is an extra space after your account password, which means you have the wrong database.
Fix: If it is a login password, report this error, as shown in the figure below:

It would be possible to have an extra space between p and 123, and then you would remove the space in between. You put p and 123 together and you type in p123
Reason 2: Your syntax is wrong, because use can only be followed by the database name, never the table name. An incorrect or incorrect table name will report the following error.

Solution: Double check your database to see if it has TB_EMP6.

Check your table again to see if it is your table name.

The name of the table is confused with the database name.
Summary is to confirm the database name is not exist, there are no spelling mistakes, if not again to see your grammar is not wrong.
This is better to locate your problem, in fact, to put it bluntly this is I made a stupid mistake, but also eat a catty gain a wisdom.
Hope to help you, welcome to leave a message to exchange ~

Online problem solving analysis

Yesterday, the company’s server upgraded the hardware, only upgraded CPU and memory, and then after the restart, things running online will not run, check, all ports and services are open, firewall those, the results found that the ports and services, firewall allowed ports are open
Still can not run, to 10 o ‘clock in the evening, suddenly a friend said, or turn off the firewall to try, the result is good, forgot to check the firewall information
The only port we’ve used so far is

cat: /etc/sysconfig/iptables: Permission denied
[dev@chttl-8a6e210a8d27536a ~]$ sudo 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]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

And that’s all,
The results after checking the firewall information found that TM also used SMB this I really do not understand

ack)
Jul 17 09:08:32 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[28014]: [2015/07/17 09:21:32.803089,  0] printing/print_cups.c:151(cups_connect)
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[28014]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 09:21:32.803424,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 09:21:32 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[31824]: [2015/07/17 09:34:33.385856,  0] printing/print_cups.c:151(cups_connect)
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[31824]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 09:34:33.386165,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 09:34:33 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[3272]: [2015/07/17 09:47:34.017469,  0] printing/print_cups.c:151(cups_connect)
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[3272]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 09:47:34.017824,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 09:47:34 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[7256]: [2015/07/17 10:00:34.651162,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[7256]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:00:34.651720,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:00:34 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[11582]: [2015/07/17 10:13:35.362361,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[11582]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:13:35.362682,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:13:35 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[15564]: [2015/07/17 10:26:35.823554,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[15564]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:26:35.823862,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:26:35 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[19370]: [2015/07/17 10:39:36.439927,  0] printing/print_cups.c:151(cups_connect)
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[19370]:   Unable to connect to CUPS server localhost:631 - Connection refused
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[1567]: [2015/07/17 10:39:36.440280,  0] printing/print_cups.c:528(cups_async_callback)
Jul 17 10:39:36 chttl-8a6e210a8d27536a smbd[1567]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL

I still don’t understand what this 631 port is for
I checked. Yes
Samba server is Unable to connect to CUPS Server localhost:631 — denied the connection
So this is a real problem. I didn’t use Samba in the first place, but then I thought, well, maybe it’s the Yamaxun server, so it’s a problem
To sum up, I still want to look at the log. I looked at the Apache log and the PHP log, but I forgot to look at the firewall log. I thought I wanted to open the ports, the results, or wrong, never think that to actually do it
 

Network card problem: Unable to initialize Windows Sockets interface

Yesterday, I had a problem with a computer in my company, which could not surf the Internet and could be Shared on Windows. Using the Ping gateway in the command window and 127.0.0.1 both showed the same results
Unable to initialize Windows Sockets interface, error code 0.
Other network Settings are normal, and there are unusually long waits in the “network connection” area when you log in to Windows.
search on the Internet to know that this is a configuration or other software caused by the improper use of Windows system file is destroyed, download winsockfix.exe run to solve the problem
The above method cannot be used for Win2003. Later, I found a method on the Microsoft website. However, this method is manual repair, which I have not tested:
1. Backup and delete winsock. DLL Wsock. DLL under % Winroot % System32
2. Backup, delete the registry key HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Winsock2
3. Delete the TCP/IP protocol and then uninstall the network card
4. Reinstall the network card and TCP/IP protocol.
Microsoft has a solution for http://support.microsoft.com/kb/288133/en-us

DHCP principle and experimental verification

I. Function overview
The main function of DHCP (Dynamic Host Configuration Protocol) is to centrally manage and assign IP addresses, so that hosts in the network environment can dynamically obtain IP address, Gateway address, DNS server address and other information, and improve the utilization rate of addresses.
DHCP protocol adopts the client/server model: When the DHCP server receives the address application information from the network host, it will send the relevant address configuration information to the network host to realize the dynamic configuration of the network host address information.
Ii. Working principle
DHCP USES UDP as the transport protocol. The host sends the request message to port 67 of DHCP server, and the DHCP server responds the reply message to port 68 of the host. The detailed interaction is as follows.
(1) DHCP Client sends DHCP Discover message by broadcasting.

    (2) all DHCP servers can receive DHCP Discover message sent by the DHCP Client, and all DHCP servers will give a response and send a DHCP Offer message to the DHCP Client. (3) The “Your(Client) IP Address” field in the DHCP Offer packet is the IP Address that DHCP Server can provide to THE DHCP Client, and DHCP Server will put its IP Address in the “Option” field so that DHCP Client can distinguish different DHCP servers. The DHCP Server will have a record of the assigned IP address after sending this message. (4) DHCP Client can only handle one DHCP Offer packet among them, and the general principle is that DHCP Client can handle the DHCP Offer packet that it receives first. (5) The DHCP Client will send a broadcast DHCP Request message, and add the IP address and the required IP address of the selected DHCP Server into the option field. (6) After the DHCP Server receives the DHCP Request message, it shall determine whether the IP address in the option field is the same as its own address. If it is not the same, DHCP Server does not do anything but clear the corresponding IP address assignment record; If the same is true, the DHCP Server will respond to the DHCP Client with a DHCP ACK packet and add the usage lease information for the IP address in the options field. (7) After the DHCP Client receives the DHCP ACK packet, it shall check whether the IP address assigned by the DHCP Server can be used. If it can be used, then the DHCP Client successfully obtains the IP address and automatically starts the renewal process by using the lease term according to the IP address; If the DHCP Client finds that the assigned IP address has been used, the DHCP Client will send the DHCP Decline message to the DHCPServer, notify the DHCPServer to disable this IP address, and then the DHCP Client will start the new address application process. (8) After the DHCP Client successfully obtains the IP address, it can Release its IP address at any time by sending THE DHCP Release message. After the DHCP Server receives the DHCP Release message, it will recover the corresponding IP address and reassigned it. 3. Experimental verification: After DHCP services are configured on servers and network devices (routers and switches), DHCP can generally be used as DHCP servers. In this experiment, routers were used to simulate the network topology, as shown in the figure below: In the diagram, routers were dhCP-server and switches were two-layer devices (switch ports connected to PC1-6 hosts were all in the default VLAN 1).

1. Before the configuration of dhcp-server is completed, PC1 is configured to DHCP to get the IP address, which is shown as follows:

The result shows “DHCP failed. APIPA is being used”, indicating that the IP address was not successfully obtained (generally a “169.254.0.0/16” segment address is displayed, indicating that the IP address was not obtained from the DHCP server).
2. Configure DHCP related information on the router:
(1) configure port IP as shown in the figure below:

(2) configure DHCP service as shown in the figure below:

3. At this point, verify the IP address acquisition above PC1:

As can be seen from the figure above, PC1 successfully obtained the CONFIGURATION information of IP address, gateway, DNS-Server, etc.

Reproduced in: https://blog.51cto.com/13401027/1977218

GoogleIO 2013 Android fast networking framework Volley introduction

Recently, I investigated the Android development framework, looked at XUtils, KjFramework and other frameworks of HTTP modules, I think it is too simple, but simply encapsulate HttpUrlConnenction and Handler, added a callback function, I feel it is better than to write a little bit. Later I found Volley, a relatively reliable Android network request framework, and used it.
Volley is the network communication library on the Android platform, making network communication faster, simpler, and more robust.
is the origin of Volley’s name: a burst or emission of many things or a large amount at once
in Google IO’s speech, the picture is a picture of firing arrows, which is similar to meteor.

in fact, from this picture, we can also see that Volley is particularly suitable for scenarios with small amounts of data but heavy communication.

GoogleIO2013 Android Quick Networking Framework Volley

 Features offered by Volley

Asynchronous download of JSON, images, etc..
Sorting of network requests (scheduling)
Prioritization of network requests
cache
Multi-level cancellation requests
Linkage to Activity and Lifecycle (simultaneous cancellation of all network requests at the end of Activity)

 

[FAILED] Failed to start Raise network interfaces

[FAILED] Failed to start Raise network interfaces. The problem
The following error occurred when starting Linux and Windows did not communicate. The reason may be that DHCP and static IP conflict, using ifconfig command only ipv6 address without IPv4 address.
The solution
Modify the following files /etc/network/interfaces. D/eth0 , remove the static IP Settings or DHCP Settings section:
for example my:

remove DHCP, changed to:

auto eth0
iface eth0 inet static
address 192.168.2.99
netmask 255.255.255.0

Restart, problem solved.

IOS development NSURLSession/NSURLConnection HTTP load failed solution

Recently, I have been busy for the launch of the new storage app. I have been busy for nearly a month. After a period of 996, I can finally take a breath today and continue to update my blog. This paper records the problems and solutions encountered when sending a HTTPS request in iOS 9. It is hoped that through this paper, we can have a deeper understanding of the configuration of ATS.
Problem description
When developing app, I encountered the problem of sending HTTPS request in iOS 9 :

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9801)

As we know, after , iOS 9, all network requests use HTTPS by default. If you send HTTP request, the following error will be reported. But we can allow HTTP request by setting the value of nsapptransportsecuritynsallowsarbitraryloads to be YES :

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

info.plist

This solves the HTTP request problem, but when I send a HTTPS request, the HTTP laod failed problem still occurs. Although the above method can also be used to solve this problem, it is not the fundamental solution.
The solution
Through the analysis, doubt is TLS problem, because the 9 default need TLS1.2 iOS version to encrypt data, if the server does not support the TLS1.2 , the URLSession: task: didCompleteWithError: returns the nil error , However, the back-end development colleagues said that the server supports TLS1.0, TLS1.1 and TLS1.2, it seems that this is not the problem of TLS. Therefore, I was not assured. I used nscurl to test the test server. As expected, TLS1.2 was not supported.

# 加 --verbose 是为了显示详细的调试信息
/usr/bin/nscurl --ats-diagnostics --verbose https://testresource.chaoaicai.com

It can be seen from the output that the server only supports TLS1.0. Therefore, the colleagues in the background development were asked to test and modify, and then tested again. It was found that the server supports TLS1.2, and the network request of HTTPS is normal.

ATS exception configuration
In fact, for the server does not support TLS1.2, but the client to send HTTPS request there is another solution, is to configure ATS, set the lowest TLS version, as shown in infos.plist :

<key>NSAppTransportSecurity</key>
  <dict>
  <key>NSExceptionDomains</key>
  <dict>
    <!--你的https域名-->
    <key>testresource.chaoaicai.com</key>
    <dict>
      <!--允许子域-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--TLS允许的最低版本号-->
      <key>NSExceptionMinimumTLSVersion</key>
      <string>TLSv1.0</string>
    </dict>
  </dict>
</dict>

Where, the specific Settings of NSExceptionDomains are described below, where ATS can be understood in more detail
NSIncludesSubdomains: is applied to the domain name, the default is NONSExceptionAllowsInsecureHTTPLoads: whether to allow HTTP requests, YES (allow), the default is NONSExceptionMinimumTLSVersion: TLS version of the lowest NSExceptionRequiresForwardSecrecy: whether to pre encryption, NO (encryption is allowed, but does not support PFS: Perfect forward secrecy), default is YESNSRequiresCertificateTransparency: the need for effective signing certificate, YES (need), the default is NO


This paper just briefly introduces how to configure ATS, and solves the problem that HTTPS cannot be accessed because the server does not support TLS1.2. It is necessary to understand the specific workflow of HTTPS and TLS, please refer to relevant materials.
The resources
# # iOS issue record about NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, - 9801)
IOS 9 comes with a series of tutorials
IOS 9.0
Clean up the pits in iOS9 adaptation (graphic)
Cocoa Keys
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) on a subdomain?

openssl TXT_DB error number 2 failed to update database

Installing the production client key file with openvpn error<

(root@cmjs – live01 – 636 2.0) #. /create key client1

Generate a 1024-bit RSA private key for ……+ + + + + +
……bb0 writes the new private key to ‘client1. key’

You will be asked to enter the information that will be incorporated into your certificate request.
You will be entering what is called a Proprietary Name or DN. there are quite a few fields, but you can leave some blank. For some fields, there will be a default value.
If you enter ‘. , the field will be empty.

Country name (2 letter code) (EN):
Name of state or province (full name) (CA):
Name of location (e.g., city) (NJ):
Name of organization (e.g., company) [Fort-Funston]:
Organizational unit name (e.g., section)[Changeme]:
Common name (e.g., your name or the hostname of your server)[client1]:
Name[changeme]: [mail@host
Email Address. Domain):

Please enter the following additional attributes to send with your certificate request

Password[] challenge:
An optional company name[]:Use configuration from /etc/openvpn/easy-rsa/easy-rsa/2.0/openssl-1.0.0.cnf

Check the request for matching signatures.

The proprietary name of the signature subject is as follows
countryName: printable: “EN”
stateOrProvinceName: printable: “CA”
localityName: printable: ‘NJ’
organizationName: printable: ‘Fort-Funston’
organizationalUnitName: printable: ‘changeme’
commonName:client
name:printable:’changeme’
Email address:IA5STRING:’mail@host ‘domain’
The certificate will be certified at 09:50:21 GMT on 1 August 2024 (3650 days).
Sign the certificate? [y/n]: y

openssl TXT_DB error number 2 failed to update database

The reason is that the commonName is the same as the commonName which generated the ca file and the server key.

Linux_ day07_ 05_ Configure common add, delete, modify and query commands in network

configuration network commonly used add, delete, change search command

modify the IP address
  1. modify the configuration file

    /etc/sysconfig/network-scripts/ifcfg-ens33

  2. ifconfig command
    ifconfig ens33:0 192.168.235.127/24
    

  3. IP command
    ip addr add 192.168.235.127/24 dev ens33 label ens33:1
    

  4. nmcli command
    nmcli connection modify ens33 ipv4.address 192.168.80.100/24 # 修改ip地址
    nmcli connection modify ens33 ipv4.gateway 192.168.80.2/24 #修改网关
    nmcli connection modify ens33 ipv4.dns1 114.114.114.114 # 修改dns信息
    nmcli connection modify ens33 ipv4.method mannual # 指定网络信息获取方式为手动指定
    
open/disable network card
  1. ifconfig command
    ifconfig ens33 up
    ifconfig ens33 down
    

  2. ifup/ifdown command
    ifup ens33
    ifdown ens33
    

  3. IP command
    ip link set ens33 up
    ip link set ens33 down
    

  4. nmcli command
    nmcli device connect ens33
    nmcli device disconnect ens33
    
add routing
  1. modify the configuration file

    /etc/sysconfig/network-scripts/route-ens33

    The

    • way

      target via gw
      220.181.38.148 via 192.168.80.2

    • each three lines defines a route
      ADDRESS0=TARGET
      NETMASK0=MASK
      GATEWAY0=GW

      Blockquote>

  2. route command
    route add -net 192.168.235.0 netmask 255.255.255.0 gw 192.168.235.2 dev ens33
    

  3. IP command
    ip route add 192.168.80.0/24 via 192.168.80.2 dev ens33 # 添加网络路由
    ip route add 192.168.80.100 via 192.168.80.0 dev ens33 #添加主机路由
    ip route add default via 192.168.80.2 dev ens33 # 添加默认路由
    
modify routing
  1. modify the configuration file

    /etc/sysconfig/network-scripts/route-ens33

    The

    • way

      target via gw
      220.181.38.148 via 192.168.80.2

    • each three lines defines a route
      ADDRESS0=TARGET
      NETMASK0=MASK
      GATEWAY0=GW

      Blockquote>

  2. IP command
    ip route change # 如果路由本身不存在则报错显示不存在
    ip route replace # 如果路由本身不存在则会直接创建该路由信息
    
delete route
  1. delete the configuration file

    /etc/sysconfig/network-scripts/route-ens33

  2. the route command
    route del -net 192.168.235.0 netmask 255.255.255.0 gw 192.168.235.2 dev ens33
    

  3. IP command
    ip route del 192.168.80.0/24 via 192.168.80.2 dev ens33
    
view routing table
  1. the route command
    route -n
    

  2. netstat command
    netstat -r # 显示内核路由表
    netstat -n # 数字格式(不进行反向解析)
    

Debian using networking to restart the network can not start the solution of network card

cause: > today’s work required to configure a DNS server for the wireless terminal configuration host test (of course, you can buy a wireless router that can match host, please skip it). Then I set up a DNS server with debian7.5. Every time I configure and restart networking ( service networking restart), the network card could not be started and then there was no way. I went to ifup eth0 to start my network card, but I don’t know why it is like this. Before, ubuntu can be restarted directly. So services networking restart comes again
try to find a way, first in the computer room to see, there is an alarm, but the server room does not take a browser, can not be copied. Start the network card first. Then go back to your office and get the log with the following command, and search for it all at once

service networking restart >>log.txt &&ifup eth0

Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces … (warning).

Reconfiguring network interfaces… Reloading /etc/samba/smb.conf: smbd only.

done.

the answer is

in the first Google post

http://am-blog.no-ip.org/BlogEngine/post/2013/12/26/Networking-restart-is-deprecated-because-it-may-not-enable-again-some-interfaces.aspx

The reason is that/etc/init.d/networking uses the program “ifup-a”. This starts only network interfaces that are marked with “auto”.

This means that the previous command to restart the network is equivalent to using ifup-a, but only starts network devices with auto fields in interfaces by default. The solution is to add the eth0 field as




try it again, done.

Linux virtual machine network “job for” network.service failed because the control process exited with error code”

problem description: ping occurrence Network is unsaid to be


restart network card: service network restart, error

Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

state is failed

sudo systemctl status network.service
● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code)
     Docs: man:systemd-sysv-generator(8)
  Process: 3253 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

solution:

systemctl disable NetworkManager