MySQL randomly dies - php

I have an issue with a mysql database that randomly just go and die obviously. When this occurs and I try to use mysql in the terminal this occurs:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
What causes this? If I restart the service it works splendid until the next random occurance when it stops working again. Am all open for ideas.

You are not mentioned your OS, mysql version, XAMPP/WAMPP here. There are some reason for this error.
If OS is windows.
If you have installed XAMPP more than one in various driver of your system, this error may happen
If you installed skype, It may be using mysql default port 3306.
Clear your browser cache and try it.

Issue was memory related. The system killed processes for more essential parts.

Related

phpMyAdmin unable to connect with mysql

I had installed MAMP on my windows 10 machine. I had then configured the MySQL thru the phpMyAdmin and had installed the WordPress. Later due to certain issues, I had to un-install and re-install the MAMP again. This time Apache started running and I could reach localhost/MAMP/, but when I click on phpMyAdmin, I get the message:
"mysqli_real_connect(): (HY000/2002) No connection could be made
because the target machine actively refused it
.....You should check the host, user name and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server". I ran the command> MySQL -u root -p status. It asked for a password. On giving the password, I got the following: Error 2003 (HY000) Can't connect to MySQL server on localhost (10061).
Please help with a workaround.
The error was resolved thru re-installation and taking care to disable the installation of MAMP Pro which happens by default.
I usually see the "actively refused" error when I try to connect to a port that the MySQL server is not actually running on. That said, I don't know why this would happen out of the blue. Maybe you should be using WAMP instead of MAMP?
You could probably troubleshoot this issue remotely with third party tools that have debug logging (MySQLShell through its Application Log)
Check all your Microsoft Redistribute Packages are installed correctly. If the problem exist then use the XAMPP or WAMP for the Windows because MAMP is generally used for the MAC OS.

How to fix "#2003 - Can't connect to MySQL server on '127.0.0.1' (61) the server is not responding."

I am having issues connecting to MySQL server. I go to localhost:8888/phpMyAdmin/?lang=en and get the error:
"#2003 - Can't connect to MySQL server on '127.0.0.1' (61) the server
is not responding."
I've tried many different solutions however, none have worked. If anyone has any advice or ways to fix this, it would be a great help.
Ensure that MySQL is enabled in MAMP, and that you have also enabled "Allow network access to MySQL" in MAMP's MySQL settings page.
I'd recommend restarting your system, and confirming that mysql daemon start with your mamp server properly. You may also try logging into the command line mysql, and observe the configuration. You seem to suggest that you have tried many things, and I assume that you tried restarting. I know it seems ridiculous to ask you to repeat this... but, you want a clean entry point to observe the issue. There may be another mysql server running as well, or it may not be serving where you think it is. By logging into MySql as root, you should be able to determine some of the mis-configuration issues.
I went to /Applications/MAMP/bin/phpMyAdmin/config.inc.php and updated the line $cfg['Servers'][$i]['host'] = '127.0.0.1';
from 127.0.0.1 to localhost.

MySQL Workbench 5.6 crashes on connection to localhost

I'm running Apache 2.2 and MySQL Workbench, and using PHP to access the database.
The problem is, when I try to open the database I've made, MySQL Workbench can't seem to connect to the localhost at port 80, and the program stops responding.
How can I fix this?
Update: After some time of the program simply not responding, it gave me this error message:
"Unhandled exception: Lost connection to MySQL server at 'waiting for initial communication packet', system error 10060 (code 2013)"
A wamp installation has a lot of issues. Instead, you can run a Virtual Machine with ubuntu and run there LAMP. it is way more reliable than running wamp that is not supposed to be "equal" in terms of your production environment - that for sure is linux based OS. Also, keep in mind that programs such skype blocks the port 80 and 443. Search what programs are using the port for mysql... that's why I don't develop AMP apps under windows, but under linux.

MySQL: 10061 error but only via PHP

I'm finding myself unable to connect to a MySQL server on my LAN using PHP, and only using PHP. Here's a breakdown of the situation.
My server is at 192.168.0.999 (well, except the 999 is in the 0-255 range of course). It's an Ubuntu server, where I have MySQL 5.5 running that I installed via apt-get.
I am using PHP 4 (no, unfortunately I cannot switch to 5 at this point) on Windows 7
I am connecting using mysql_connect() (and again, no switching to another API is not an option at this point). mysql_error() says: Can't connect to MySQL server on '192.168.0.999' (10061)
I can telnet to 192.168.0.999 port 3306 and although PuTTY gives me an error about packet order, there's quite clearly a MySQL server listening on that port.
I can connect by starting cmd and typing mysql -h192.168.0.999 -uusername -p, (of course my username is not actually 'username') and after I type the password I can run queries.
I've triple-checked the credentials in my PHP script for typos, so I am now quite completely stumped. I understand that error 10061 is a network error and that either MySQL or the box it runs on, is refusing my connection, but I cannot reconcile this with the fact that I can telnet to the very same host, and can connect easily with the standard mysql client on my machine.
Before anyone brings it up, AFAICT I've followed the troubleshooting steps in the MySQL manual to a T and the PHP manual does not seem very helpful. Copying the database to my local machine is very logical, and very desirable, but also very impractical.
Can anyone help me?
You've stated that you are running this on windows, and that you can access MySQL through command line but not PHP.
This sounds like permissions problems - are your table InnoDB by any chance?
If so, check the permissions on the InnoDB database files.
As it turns out, I was connecting to the right host, but to the wrong port. For reasons that are not really relevant to the question, my MySQL instance runs on port 3307 instead of 3306, so I've set mysql.default_port to 3307 in my php.ini file.
Mystery solved: PEBKAC!

PostgreSQL connection problems

I have very strange problem with my application, upon occasions I get following error when connecting to postgres. This happens without any pattern, often happens when I run some extensive selenium tests.
Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.
Postgres logs shows no abnormalities, also other applications that run on same postgres instance have no problems at all.
My Postgres is 8.2.9, running on windows 2008 server
Any hints ?
"server closed the connection unexpectedly" most of the time means the backend crashed. If that's the case there should be some lines about it in the server log.
And by the way the latest version in the 8.2 branch is 8.2.12. Upgrade, test, report.
A random guess. Do you use persistent connections?
You're only showing the client error. Since it means that something happened on the backend, you will need to look in your server logs for information about what actually happened. (The postgres logs and/or the eventlog - check both)
A typical reason for these things to happen is if you are running some antivirus software on the server. If you do, try uninstalling it (not just disabling it) and see if the problem goes away.

Categories