MySQL commands: Difference between revisions

Jump to navigation Jump to search
924 bytes added ,  29 June 2016
Line 131: Line 131:


==== ERROR 2002 (HY000): Can't connect to local MySQL server ====
==== ERROR 2002 (HY000): Can't connect to local MySQL server ====
condition on Cygwin terminal of Windows:
Condition on Cygwin terminal of Windows:
<pre>
<pre>
$ mysql -u root -p
$ mysql -u root -p
Line 142: Line 142:
</pre>
</pre>


solution:
Solution:
* {{kbd | key=<nowiki>-h localhost</nowiki>}} 變數值改成指定 {{kbd | key=<nowiki>-h 127.0.0.1</nowiki>}}
* {{kbd | key=<nowiki>-h localhost</nowiki>}} 變數值改成指定 {{kbd | key=<nowiki>-h 127.0.0.1</nowiki>}}
<pre>
<pre>
$ mysql -h 127.0.0.1 -u root -p
$ mysql -h 127.0.0.1 -u root -p
</pre>
==== Error Code: 2013. Lost connection to MySQL server during query ====
Condition: After executed the following query contains number of rows which exceed 1,000,000 rows, I met the error message 'Error Code: 2013. Lost connection to MySQL server during query'.
<pre>
INSERT IGNORE INTO `target`.`table` SELECT * FROM `source`.`table`;
</pre>
Solution:
* Increase the setting of '''DBMS connection read time out (in seconds)''' on [https://www.mysql.com/products/workbench/ MySQL Workbench]. <ref>[http://stackoverflow.com/questions/16877574/how-can-i-execute-sql-queries-that-take-longer-99-999-seconds-on-mysql-workbench How can I execute SQL queries that take longer 99,999 seconds on MySQL Workbench? - Stack Overflow]</ref>
* Reduce the number of rows to reduce the execution time by using {{kbd | key=LIMIT}} clause ex:
<pre>
INSERT IGNORE INTO `target`.`table` SELECT * FROM `source`.`table` LIMIT 0, 10000;
</pre>
</pre>


Navigation menu