MySQL can't show table after altering auto_increment - mysql

I created two tables like this
and I want to change the added data's id so I use
alter table member auto_increment=5;
after this, it couldn't show my member table. It shows
error 2013: lost connection to MySQL server during query.
I thought my table is too big to run, so I changed the limit and the DBMS time out, but it didn't work either. Can someone tell me what's the problem now?

I found the problem. Don't edit your MySQL database when you're connecting it with your Python Flask program. Edit means any CRUD actions.

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.

Get MySQL database structure alter queries

I'm working on a version control program, and I would like to implement database structure versioning as well.
Is there a way to get a list of all the queries that have altered the databse structure in any way?
For example I added a column to the 'users' table called 'remember_token'. Is there a way I can get the specific query that was executed on the MySQL server in order to add that column?
You may want to enable the mysql query log and then filter on ALTER queries or anything you need

What's SQL equivalent of MySQL SHOW CRAETE TABLE query

I have a remote SQL Server database that I don't want to copy because of it's size. I want to just remotely import it's creation query to duplicate it's structure locally.
I know there was a query for it but lost somewhere my book about it. I ask for name of that query method that I described. If got any questions please don't hesitate to ask.
I found it. It's SHOW CREATE TABLE http://dev.mysql.com/doc/refman/5.0/en/show-create-table.html

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

MySQL "Error 1005" when adding tables

I've recently been working with a MySQL database, and using MySQL workbench to design the Database.
When I use the export to SQL function, so I can actually get the layout in to the Database, I get:
"Error 1005: Cannot create table"
This appears to be related to Foreign Keys in the create table statement.
Does anybody have a work around for this that doesn't involve taking the constraints out and putting them back in later? That's a less than ideal solution given the size of the database.
When you get this (and other errors out of the InnoDB engine) issue:
SHOW ENGINE INNODB STATUS;
It will give a more detailed reason why the operation couldn't be completed. Make sure to run that from something that'll allow you to scroll or copy the data, as the response is quite long.
I ran into this situation recently when I attempted (in InnoDB tables) to make a foreign key reference to a column that had a different data type.
MySQL 5.1 Documentation