I am using a partner xml feed on my website, the url is like xml.partner.com. Now they are planning to decommissioning the server and pointing the domain to new server.
I have been told to point the host files on my server to their new server IP.
My server is CentOS Linux 6.8 with Apache/2.2.15 running
I have this on /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain
localhost6 localhost6.localdomain6
0.0.0.0 xml.partner.com
I couldn't see any changes. So not sure the above line is working.
Do I need to change anything on Apache configuration file? or restart Apache?
I am new to this, any help would be appreciated.
Note: When I ping their xml.partner.com I can see that it is pointed to the new server. So unless they are not decommissioning the domain Should I bother about this?
Yes. You need to change in the /etc/httpd/conf/httpd.conf file. Find out the Listen keyword in the file.
In my case: #Listen 12.34.56.78:80 and replace the ip 12.34.56.78 with your new server IP address and then restart httpd server.
Related
I've installed MySQL on a Google Cloud Virtual Machine (debian buster). What I want to do is to make this accessible publicly (using username / password obviously).
As far as I can tell the server is visible from the outside world, as I can ping the IP and I get results, and I think I've set up a user correctly and given the appropriate permissions so I can log in.
For info, my firewall settings on GCP look like this (this is just the egress, there is one exactly the same for ingress):
Which I'm assuming is correct and leaves the correct port open?
The issue I have when I use MySQL Workbench is that when I try to create a new connection, it gives me the following error:
Your connection attempt failed for user 'username' to the MySQL server at [my ip address]:3306:
Unable to connect to localhost
Please:
1 Check that MySQL is running on address [my ip address]
2 Check that MySQL is reachable on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the user username has rights to connect to [my ip address] from your address (MySQL rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for [my ip address] connecting from the host address you're connecting from**
Any pointers would be gratefully received.
Update: What is really confusing me is the 'Unable to connect to localhost' error. I'm not trying to connect to localhost...?
Update 2: As per comments, results of the following commands:
Note I am trying to connect using the matprichardson username. The svc2toria user is pointing to my own IP address.
Mat, If you want to use your Google Cloud Instance Database using your MySQL workbench. I suggest you connect to it through an SSH tunnel. So, this problem won't happen. I also ran into this problem several times. Connecting through SSH made the job done.
But if your need is something else, this would not help you at all. If your only purpose is managing your database from your local machine using the MySQL workbench. This will work nicely. Create a USER in your Debian VM. and open port 22 to the public. Also, make sure to have strong credentials or a better key file when connecting through SSH. This method is working for every cloud VM database. I'm using this method for G-Cloud, Azure, and AWS. After all of your work is done. Close port 22 (SSH).
My best guess will be because of number 2. "Check that MySQL is reachable on port 3306 (note: 3306 is the default, but this can be changed)".
Your Virtual Machine will have network security controls / firewall which will be blocking port 3306 by default.
I don't use Google cloud but I believe you are looking for "network details" -> "Firewall rules".
did you change your mysqld.cnf already?
bind-address = 0.0.0.0
As none of the suggestions posted worked I went for the rather more nuclear option of deleting and rebuilding my VM and setting MySQL up again from scratch. I must have done something wrong in my initial setup, as things worked without any issues at all once I’d done this.
The location of the MySQL configuration file differs depending on the distribution.
In Ubuntu and Debian the file is located at /etc/mysql/mysql.conf.d/mysqld.cnf
while in Red Hat based distributions such as CentOS, the file is located at /etc/my.cnf
Open the file with your text editor :
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Search for a line that begins with bind-address and set its value to the IP address on which a MySQL server should listen.
By default, the value is set to 127.0.0.1 (listens only in localhost).
In this example, we’ll set the MySQL server to listen on all IPv4 interfaces by changing the value to 0.0.0.0
bind-address = 0.0.0.0
# skip-networking
If there is a line containing skip-networking, delete it or comment it out by adding # at the beginning of the line.
In MySQL 8.0 and higher, the bind-address directive may not be present. In this case, add it under the [mysqld] section.
Once done, restart the MySQL service for changes to take effect. Only root or users with sudo privileges can restart services.
To restart the MySQL service on Debian or Ubuntu, type:
sudo systemctl restart mysql
On RedHat based distributions like CentOS to restart the service run:
sudo systemctl restart mysqld
For more Detail Read Here
OS: Ubuntu 14.04 LTS
php version control : phpbrew
php version : 5.5.10
I pinged localhost which resolved to 127.0.0.1.
This indicates that my host (/etc/hosts) file is correct.
127.0.0.1 localhost
Whenever I try connecting to MySQL using a php script like the one below it doesn't work and gives me the error: no such directory.
//connect to the database
mysql_connect("localhost","root","password") or die(mysql_error());
However, when I connect via 127.0.0.1 it will work
//connect to the database
mysql_connect("127.0.0.1","root","password") or die(mysql_error());
Additionally, my phpmyadmin does not work when logging in using "localhost" i had to change the file to add 127.0.0.1 option during log on.
How can I use localhost to connect to the MySQL database?
PHP is still trying to use the default socket location. This problem can appear if you have moved the MariaDB/MySQL folder from /var/lib/mysql to another location. In order to solve the problem you have to define the new socket's location in the /etc/php.ini file.
mysqli.default_socket =/newDBLocation/mysql/mysql.sock
Watch out, depending on which driver you use, you may have to specify the pdo_mysql.default_socket=!
In order to check your current directory run the following command in mysql:
select ##datadir;
In many cases localhost is a hint to use the UNIX socket to connect to the MySQL server process, where 127.0.0.1 forces a TCP connection. Sometimes the UNIX socket is in an unexpected place, or simply isn't accessible, which results in the "file not found" error.
The socket is typically something like /tmp/mysql.sock or could be in some other place depending on your distribution and how much you've customized it.
Keep in mind that access via UNIX socket, which is local to the server by definition, and TCP are controlled by two different rules. localhost in a GRANT refers to UNIX socket. % or some specific host name refers to remote via TCP.
The answer to this problem was that in the my.cnf located within
/etc/mysql/my.cnf
the line was either
bind-address = 127.0.0.1
or
bind-address = localhost
it should have been
bind-address = 0.0.0.0
which will allow all connections
i can't connect to PhpMyAdmin on my local server as shown bellow, it shows me the message "#1130 - Host 'localhost' is not allowed to connect to this MySQL server", i think the problem is with MySql, someone can help pleas ?
try given link
#1130 - Host ‘localhost’ is not allowed to connect to this MySQL server
This sounds like it might be an IPV4/IPV6 issue. Modern browser will use either, why the decide to use IPV4 or IPV6 address ranges, I dont know yet.
You can test this theory by launching phpMyAdmin like this 127.0.0.1/phpmyadmin if that works and ::1/phpmyadmin does not, then the problem is probably related to phpMyAdmin not being allowed to be run from the ::1 IPV6 address.
First make sure you have these entries in your HOSTS file \windows\system32\drivers\etc\hosts
127.0.0.1 localhost
::1 localhost
These entries will associate the domain name localhost with both the IPV4 (127.0.0.1) and IPV6(::1) loopback ip address's i.e. connect to this machine when you see the domain name localhost.
If you have to change the HOSTS file you then need to reboot or run these 2 commands from a command windows that is started using "Run as Administrator" to refresh the dnscache and pick up your changes.
net stop dnscache
net start dnscache
Next check the Alias settings for phpMyAdmin.
Edit the \wamp\alias\phpmyadmin.conf file.
Make sure that both 127.0.0.1 and ::1 are allowed to connect to Apache
If you are using Apache 2.2.x then look for this section and make sure it contains this in the Allow from line
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
If you are using Apache 2.2.4 then look for this section and make sure it contains this in the Require line. If you still have the old Apache 2.2 syntax in here, remove it and use this instead.
Require local
The Require local covers both localhost, 127.0.0.1 and ::1 in Apache 2.4
I would help, but I can't read the text in your image and there is no code either.
I have a Mac running Mavericks with MySQL installed from homebrew. When I try nmap localhost and I see:
3306/tcp open mysql
When I try this same command with my computer name:
nmap my_comp_name
I do not get 3306 but I get:
PORT STATE SERVICE
80/tcp open http
3128/tcp open squid-http
8080/tcp open http-proxy
It also says my computer name resolves to some ip address. When I try nmap with that ip address, I get the same response as above. I want to be able to connect to this database with Visual Studio running on my Parallels VM.
This happened some time yesterday and I finally figured out that Norton anti virus was installed blocking that port. So I uninstalled Norton with one of their scripts and restarted. Everything was working fine at work, and then I came home and again, the port is closed.
I do not have a firewall on for either my Mac or Windows (Parallels VM) machine. I cannot figure out why this port gets closed. I do not have a firewall set up on my home network either. This port has been opened in the past on my home network as well. I am at a loss of figuring out what is causing this port to just suddenly close without even rebooting my computer. I basically come home, and port 3306 is now closed. Any thoughts?
Edit: I have also tried adding port = 3306 in the my.cnf file, restarted apache, and that also does not solve my problem.
When you run nmap against localhost it uses IP address 127.0.0.1. When you run it against your hostname, it uses the 'real' IP address of your host.
Clearly you have MySQL configured to bind only on IP address 127.0.0.1, and need to change the config to bind to all addresses if you want to access MySQL from a different host (even if the host is running in a VM inside your machine).
Find the file /etc/my.cnf and see if it contains a line like
bind-address=127.0.0.1
If it does, remove it or change it to
bind-address=0.0.0.0
If my.cnf does not contain a line binding to 127.0.0.1, then you may have to find the script that starts MySQL and examine it to see how it sets the bind address.
You don't need to create or edit my.cnf
Open mysql launch file
vi ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
And change this line
<string>--bind-address=127.0.0.1</string>
to
<string>--bind-address=0.0.0.0</string>
And finally reload MySQL
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
This seems like a binding problem. It seems like it is binding to your private ip instead of all or 127.0.0.1/localhost. But that is just from the top of my head.
From the mysql documentation:
The MySQL server listens on a single network socket for TCP/IP
connections. This socket is bound to a single address, but it is
possible for an address to map onto multiple network interfaces. The
default address is 0.0.0.0. To specify an address explicitly, use the
--bind-address=addr option at server startup, where addr is an IPv4 address or a host name. If addr is a host name, the server resolves
the name to an IPv4 address and binds to that address. The server
treats different types of addresses as follows:
If the address is 0.0.0.0, the server accepts TCP/IP connections on
all server host IPv4 interfaces. If the address is a "regular" IPv4
address (such as 127.0.0.1), the server accepts TCP/IP connections
only for that particular IPv4 address.
Configuration
You can set bind-address directive in my.cnf. Edit /etc/my.cnf or /usr/local/etc/my.cnf, run:
$ nano /etc/my.cnf
Set the address to 0.0.0.0:
bind-address = 0.0.0.0
Make sure you delete the following line or comment out the following line:
#skip-networking
Save and close the file.
Finally restart the mysql service.
source.
I am setting up MySQL on an Ubuntu 11.04 Server and had a problem connecting remotely. I changed the bind-address property in the my.cnf file to be the IP address of the server instead of 127.0.0.1 loopback. Now remote connections work fine, but I can't connect to it locally with my local web app. How can I accomplish this? Thanks!
You can comment out or remove the bind-address from your my.cnf if you want mysql to listen on all IP addresses. Restart.