I'm running MySQL with DBngin and i get this error. It seems that laravel can't even connect to the database.
SQLSTATE[HY000] [2006] MySQL server has gone away
I saw that increasing the 'max_allowed_packet` the issue can be solved but i haven't found a way to do that in my case.
i downloaded mysql-client and after i connected to my database, i tried to set the max_allowed_packet
set global max_allowed_packet=16000000;
But for some reason it doesn't change, I checked that with
SHOW VARIABLES LIKE 'max_allowed_packet';
This can also be changed in the my.cnf file but because i am running MySQL with DBngin i couldn't find the configuration file. I know that i can set a custom configuration file in DBngin but i'm not sure what else i should include in that file besides the max_allowed_packet in order to make it work.
Any ideas ?
Related
We're using Lampp stack, PHP PDO, centos 7, MySQL 8. The database server and the MySQL server are different.
On long operations like file uploading, I get
SQLSTATE[HY000] [2002] Cannot assign requested address
Per this answer, I tried making the PDO connection persistent, didn't fix it. the other answer suggests increasing max open files in /etc/security/limits.conf but I didn't find that option in that file.
How to fix that error? does editing that file or any file requires a server restart? Because it's a production server, I need to notify the team should any of the solution require a server restart
I am using MySQL Workbench. I shut down and restart my server. After that I was not able to execute any queries as the error always come up immediately.
Error 2006:MySQL server has gone away
I have started the MySQL57 services manually so I am sure the server is running. Looking up SO, two solutions come up - (1) set max_allowed_packet = 128M in my.ini [Failed], (2) set wait_timeout to a larger number - I cannot find the my.cnf file so this doesn't work.
What I encountered is pretty different from others as they usually had this error after a long piece of queries, but mine just comes up immediately after a query is sent. Appreciate any help (include finding the my.cnf file).
Update:
Discovered something that may help, what I have done:
Start MySQL57 from services.msc manually
Open MySQL Workbench, connect to database
Test the connection, and said "Successfully made the MySQL Connection"
Run a query, return "Error 2013: Cannot connect to MySQL Server on local host"
Run the query again, return "Error 2006: MySQL Server has gone away"
Check services.msc, the MySQL57 has been switched off.
When I write the command line C:\wamp\bin\mysql\mysql5.6.17\bin>mysqld
nothing happens. It just shows the path again C:\wamp\bin\mysql\mysql5.6.17\bin>
and when I write this:
C:\wamp\bin\mysql\mysql5.6.17\bin>mysql
it shows an error: ERROR 2003 (HY000): Can't connect to mysql server on 'localhost' (10061)
I tried a lot to find an answer to this, but I couldn't find anything useful. Why isn't the server working?
I installed the same program for my friend, too and it works fine for her.
The error ERROR 2003 (HY000): Can't connect to mysql server on 'localhost' (10061) means that the MySQL server daemon is not running and so the client mysql can not connect. That makes sense, because mysqld doesn't start.
There are plenty of reasons, often its simply a misconfiguration or port collision (3306 already used?).
The first step is to make sure that the daemon is working without a configuration file. Please try to start the daemon by using mysqld --no-defaults.
no-defaults means that mysql will not read any option files, before starting.
If it starts up, you know that the configuration file(s) are to blame.
Then search in your my.ini for "wrong" or "old and deprecated" entries and fix them, to allow a normal startup. Its also helpful to enable logging.
If you are in doubt, go with one of the default configuration files: https://dev.mysql.com/doc/refman/5.6/en/server-default-configuration-file.html
You can check the ports with a tool like CurrPorts:
http://www.nirsoft.net/utils/cports.zip
I'm trying to run sonar-runner.bat, when it almost finished analyzing, it's written max_allowed_packet more than something something. So it fails.
Through deep search, everyone said that i should configer my.ini file inside MySQL folder. But,
I don't have MySQL Installed.
Log:
Error: unable to execute sonar
error: caused by: unable to save file sources
error: caused by:
Error updating database. cause: com.mysql.jdbc.packettoobigexception: packet for query is too large (3215747 >1048576). you can change this..bla..bla
the error may involve org.sonar.core.source.db.filesourcemapper.insert-inline
the error occurred while setting parameters
how can i change it?
help!
As #Fabrice- SonarQube Team suggested that you are running SonarQube Server on top of Mysql. If you want to check you can check within Sonar.properties file.
for removing this issues you have to modify the my.cnf(Linux) or my.ini(for windows).
[mysqld]
max_allowed_packet=256M
if you want to set the same Globally.Log in to Mysql and run the following command.
SET GLOBAL max_allowed_packet=1073741824;
Once you do this settings, Please restart Mysql Server.
I found the answer myself.
Looks like I don't realize how the database works in Sonarqube.
So by DEFAULT, sonarqube use H2. This is a good one, and I believe such my problem won't happened.
Turned out someone from my company actually used his own MYSQL server. So, I found the MySQL folder, change .ini/.cfg file, insert MAX_ALLOWED_PACKET value to bigger number.
VOILA!
Thanks for your help!
I am developing a C program that accesses mysql. I have the following line in my code:
sts = connect_to_server(&mysql, "localhost", "my_username",
"my_password, "my_databasename");
with the actual values replaced, of course. I get:
Failed to connect to MySQL: Error: Can't connect to local MySQL server
through socket '/tmp/mysql.sock' (2)
I have seen other questions like this, and the answer is usually that the server is down. In this case it is not. PHPMyAdmin can access the server just fine.
And many of the other responses said to check for the socket file. It is present
(/Applications/AMPPS/mysql/tmp/mysql.sock).
Could this be something to do with paths or something? It isn't adding the path to "/temp/mysql.sock" and therefore can't find it?
I know very little about unix. I have been running OSX for nearly 10 years, but I almost never go down to that level.
Take a look into the mysql configuration file (typical my.cnt somehwhere under /etc) and adjust the value for socket to fit your needs.
Alternativly you could just link /tmp/mysql.sock to /Applications/AMPPS/mysql/tmp/mysql.sock:
ln -s /Applications/AMPPS/mysql/tmp/mysql.sock /tmp/mysql.sock
I think wrong my.ini is getting loaded. By default it looks at /etc/my.ini so if it is present just rename or delete it. Restart your MySQL Server.