DROP TABLE not working? - mysql

I have tried relentlessly to drop a table, but it doesnt seem to work. It doesn't give me any error message, but it seems like its taking a long time (6+ hrs). The table has around 800K rows with two columns.
Additionally, I can't even access the table using sequel pro or through the command line interface. The sequel pro message says Loading, but it never loads and command line gets stuck in the command without any messags.
However, DESCRIBE command works with the table.
I have similar problem with another table that has fairly less number of rows at 1000+.
However, i have other tables in the database that works perfectly fine.
Are there any issues with this version of mysql (see below) or are there any other methods that will let me delete the table.
I am using MySQL 5.1.73 Source distribution

Related

How to repair a specific table in prod database

I have a production database in which I have multiple tables. There is one table in which I store the server responses for the API calls which I receive.
Now that particular table is not working properly. I mean, the data is getting added into that table.
When I click on info button of the table, am getting the details which include number of rows and all. I can see that it's increasing. But the problem is that, whenever I try to execute any query on that table, my MySql workbench crashes.
I tried repair table indoor.ServerResponse; but again this query also doesn't work. It keeps on running and somewhere down the line, it freezes.
I just have few thousand rows in that table.
Now my question is :
1) How do I repair the table ? Did I lose it all?
2) How do I make sure that this doesn't happen in future? As this is the prod database.
3) I am also not able to Alter other tables in the database. But the queries run fine. Why is it so?
P.S. Am using MySql workbench.

Database table columns missing in MySqlWorkBench

I am working with mysql workbench 5.2.47 on Mac. I have created new database, table and some columns in the table. Sometimes, when I open this database (connection is fine) in mysql workbench, it is not showing any columns that I created under the table. But, if i close and open mysql workbench multiple times, and then its displaying the columns under that table. It is not happening always, but sometimes only it is not showing any columns that I created under the table.
I couldn't any find solution or workaround what to do this to get the actual columns displayed under the table.
Screenshot for reference:
Solved! Seems like a lot of people are stuck in this odd situation.
There is an easy solution to this.
Hover abbove the "Object Info" and "Session" and your cursor will change to split arrows. Then all you have to do is drag it downward and it will reveal the hidden sidebar with Management, Schemas etc.
Enjoy!
I, personally, faced this problem only when I was disconnected from the server. So, when you try to execute an SQL query you receive an error like:
"Error Code: 2006. MySQL server has gone away."
Go to the option "Query" and then "Reconnect to Server," or simply close the connection and open it again. If yours happens to be the same case as that of mine, you should be able to get the columns displayed again.
Click the little "Refresh" icon (to the right of Schemas). Also, upgrade to Workbench 6.1.x as the 5.2 branch is no longer maintained.

Rails persisting table data after MySQL truncate

I truncated 2 tables in my database in MySQL (for a Rails project) so that I could repopulated it with test data. But for some reason the application is still counting how many entries there used to be (250), even though there is only 9 entries now.
I even went into the ruby console using (ruby script/rails console), then truncated using:
ActiveRecord::Base.connection.execute("TRUNCATE TABLE bars;")
but that didn't do anything different then running the query through MySQL. I am pretty confused, the only thing I can think of doing is restarting the server. I am just wondering if there is maybe another way to do this without having to reboot everything.
Printing the search to the logger I can see that the results for the bars are a bunch of nil values for where there used to be a bar_profile, but I have truncated the tables that referenced bars or bar_profiles.
So I don't get why it would just be returning what the results would have been before the tables were truncated. Except now now instead of returning actual results they are just nil.

MySQL Error 2013 after a failed attempt to import

I was importing one table in a MySQL Server when the power went down. After this event I tried to query the table I was importing, but got the error 2013, only when I'm querying this table (the others work just fine).
I have physical access to the server, tried to execute any query from there (tried to SELECT, and even DROP TABLE) but still got the same error.
Does anybody know a solution where I can re-build only the table (without building the whole schema from scratch?)
I'm adding this as an answer rather than having lots of comments underneath. I must state in advance that I've not used MySQL but I have used SQL server a lot so I'm hoping that something I say may help.
You say the table is still there. Was it created as part of the operation you were doing or had it been there for a while?
What happens if someone else or a different account tries to access this table?
Is there anything on this page that is relevant to your problem?
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

DatabaseLookup hangs on specific values

I use Kettle for some transformations and ran into a problem:
For one specific row, my DatabaseLookup step hangs. It just doesn't give a result. Trying to stop the transformation results in a never ending "Halting" for the lookup step.
The value given is nothing complicated at all, neither it is different from all other rows/values. It just won't continue.
Doing the same query in the database directly or in a different database tool (e.g. SQuirreL), it works.
I use Kettle/Spoon 4.1, the database is MySQL 5.5.10. It happens with Connector/J 5.1.14 and the one bundled with spoon.
The step initializes flawlessly (it even works for other rows) and I have no idea why it fails. No error message in the Spoon logs, nothing on the console/shell.
weird. Whats the table type? is it myisam? Does your transform also perform updates to the same table? maybe you are locking the table inadvertantly at the same time somehow?
Or maybe it's a mysql 5.5 thing.. But ive used this step extensively with mysql 5.0 and pdi 4.everything and it's always been fine... maybe post the transform?
I just found the culprit:
The lookup takes as a result the id field and gave it a new name, PERSON_ID. This FAILS in some cases! The resulting lookup/prepared statement was something like
select id as PERSON_ID FROM table WHERE ...
SOLUTION:
Don't use underscore in the "New name" for the field! With a new name of PERSONID everything works flawlessly for ALL rows!
Stupid error ...