Only one mySQL database loses connection - mysql

I am trying to drop one of my databases in mySQL, but I keep getting error 2013: lost connection (this occurs with other queries in this database as well). However, any other database works fine; I can perform queries and delete databases and tables easily.
I've tried googling it, but everything I've seen has essentially said that this lost connection is because of a large or complicated query.
My code is just
DROP DATABASE employees;
However, when I expand that database, it also says Tables/Views/Stored Procedures/Functions cannot be fetched, if that helps (once again, my other databases don't have this problem).
I created this database in Jupyter notebooks using mySQL python connector, and the others I created directly in mySQL, but that is the only real differentiating factor between them.

Ok, I figured it out. Turns out if you're running the code in Jupyter Notebooks and try to perform any actions before closing the cursor, it won't run. (I forgot to run the cell with mycursor.close()). Thanks!

Related

How to bring back PHPMyAdmin Functions View in the DB left-pane

Recently, the left-pane DB preview in PHPMyAdmin lost the Functions folder. Already struggling the entire day to search a solution, but I cannot find anything similar to this problem. Together with this problem, I notice that when I hit the Structure view of a table it doesnt load anymore the table structure, but via MySQL command line though I can see everything.
Following various other topics on other phpMyAdmin left-pane view problems, I have verified that my user has ALL privileges.
Restarting MySQL (MariaDB actually) causes no change in the above results
I expect as so far the left-pane to show me the Functions folder as well as showing me the tables structure
I have just found the solution after 1 day of searches: this one worked perfectly MySQL Error 1 (HY000) Trouble creating file Errcode 2

Is there a good way to perform SQL dump of MySQL database in DataGrip?

I'm trying to use JetBrains DataGrip as my primary DB tool. However, I still find myself using SequelPro for SQL Dump. Here is why:
On a database level, I couldn't find any SQL dump functionality. The only options seems to be "copy DDL", which copies the schema, but not the content.
On a table level, sure, I can export data as SQL Inserts. But then it seems the only way to do so is to export it from each table separately, which is unacceptable. Another downside is, when exporting data as INSERT, it creates a separate INSERT statement for each row.
I tried to look for plugins, but couldn't find any. DataGrip users, if you came up with any solutions, please let me know. Sequel Pro works like a charm, but I really would love to use one database client at the end of the day.
PS. SSHing to a server and running sqldump is not an option for me, for various security reasons.
In 2016.2 there is some functionality, check like in screenshot.
2016.3 will be integrated with mysqldump.

How to execute SQL queries inside MySQL workbench

I am developing an application using Django framework. As you may know the workflow is you first describe your objects in Python classes and then you synchronize the database.
I made a MySQL Workbench EER diagram. Since then I continued to develop the application, so the database model is not updated in the EER diagram nor the MySQL Workbench model.
I tried to synchronize it using the built-in feature "Synchronize with Any Source" of MySQL Workbench, but this feature is not working for some reason and causes a segmentation fault. The queries to be executed inside the MySQL Workbench model are displayed but at the last step I get an empty SQL alter script. I tried manually copying the queries in that script and clicking the "Execute" button, but I had no luck with that. I think MySQL stores queries internally. Anyway. I submitted the bug to MySQL Workbench developers here and now it is fixed, but not yet released. I am now looking for a workaround while waiting for the next release.
Although I have a specific problem, the question remains generic.
Is it possible to execute queries on the MySQL Workbench model in order to alter it?
Did you try the "Forward Engineer" option? It allows you to reflect all the changes that were made to your table relations directly to the database which is a pretty useful functionality.
There are some catches though like the inability to maintain existing data every time forward engineering is performed however this can be compensated by entering some example data which will be shipped with the ER diagram the next time you perform "Forward engineer".

How to compare/update two mySQL databases' schema

Okay, I've got two databases, the second one being a more up to date version of the first one. It has new columns, tables, constraints, and whatnot.
I was wondering if there is a solid program out there that will update the first database with all that of the second already updated database (Not the data, just the tables, columns and all that) or am I stuck creating my own update script from scratch?
I actually found another post, that did not look like the same thing but it still helped me anyway, I found a program called Toad for MySQL and it has a compare Schema option that compares the two databases and then can sync one to the other (it creates a script and executes it) it seems to be working flawlessly, but I'm still testing the web app that uses the database to ensure this is true.
If you're on Windows, the RedGate SQL data and schema compare tools are beautiful:
http://mysql-compare.com/info
I've used them a few times. They're quite simple to use.
They're designed around creating DB diffs for moving from dev/QA/staging environments to integration/production environments (so yes, they generate scripts).
If you are looking for a tool that will compare at the schema level then I would suggest Navicat. The older version that I use works well for getting my production and development boxes in synch. I don't recommend it for large levels of data synchronization though - it seems very slow compared to a SQL dump and SQL import.

From where the Mysql history is coming in Workbench?

i have observed that workbench has an option called history, which is giving all my db operations in day wise, i want to know from where it is getting, i mean is mysql is maintaining any table internally. I need to update the databse everyday to my client so it will be useful to me, Please help
If anyone still needs this the history is stored (at least in Windows 7) in UserFolder\AppData\Roaming\MySQL\Workbench\sql_history in separate XML files for each day.
For mac users, you can find the history files at
/Users/<username>/Library/Application Support/MySQL/Workbench/sql_history
Though the history file stored there only has some dates in it(Seems like Workbench is using it for some indexing.... not sure though). If you need actual history with queries you can check the log files at
/Users/<username>/Library/Application Support/MySQL/Workbench/log/
I think that regarding this http://dev.mysql.com/doc/workbench/en/wb-history-palette.html the Workbench history is kept from what you acctually execute in the workbench and it is not taking this data from the MySQL server.
Is is a log of queries that you have run in Workbench.
Also "Like the mysql command line client utility, MySQL Workbench has a full history panel, which provides complete session history. This makes it very easy for a user to review, re-run and modify previously executed SQL statement(s). Along with that, multiple queries can be executed at the same time while their results can be viewed in individual tabs. You can also have multiple SQL tabs open at the same time."