Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lost connection to MySQL server during query? [duplicate]

Tags:

mysql

Possible Duplicate:
Lost connection to MySQL server during query

I am importing some data from a large csv to a mysql table. I am losing the connection to the server during the process of importing the file to the table.

What is going wrong?

The error code is 2013: Lost connection to the mySql server during the query.

I am running these queries from a ubuntu machine remotely on a windows server.

like image 449
Shyam Natraj Kanagasabapathy Avatar asked Jun 29 '11 07:06

Shyam Natraj Kanagasabapathy


People also ask

How do I fix the lost connection to MySQL server during query?

Open the MySQL Workbench Preferences. Check if the SSH Timeout and DBMS Timeout value is set to only a few seconds. Try to increase the default value of the connection timeouts. Save the settings, close the MySQL Workbench and reopen the connection to see if you are able to connect to the database.

How do I fix MySQL workbench connection?

Check the root has rights to connect to 127.0. 0.1 from your address (mysql rights define what clients can connect to the server and from which machines) Make sure you are both providing a password if needed and using the correct password for 127.0. 0.1 connecting from the host address you're connecting from.

What is Mysqldb?

MySQL is a relational database management system (RDBMS) developed by Oracle that is based on structured query language (SQL). A database is a structured collection of data.


1 Answers

Try the following 2 things...

1) Add this to your my.cnf / my.ini in the [mysqld] section

max_allowed_packet=32M 

(you might have to set this value higher based on your existing database).

2) If the import still does not work, try it like this as well...

mysql -u <user> --password=<password> <database name> <file_to_import 
like image 178
Ashwin A Avatar answered Sep 24 '22 13:09

Ashwin A