2

I have an innoDB database.

Yesterday my database crashed and I could not recover it, so I just deleted it from /var/lib/mysql directly.
After this, I restored database from dump, but I'm getting messages like this:

ERROR 1050 (42S01): Table 'production.itex_product_props' already exists

To fix this, I can do two things:

  1. Create database with another name
  2. Create dumps of all databases on my server, delete databases, delete files like ibddata1, and restore all databases from dump.

Can I fix this error another way?

Nikita
  • 21
  • 3

2 Answers2

1

You just need a tip: make sure that your mysql databases are consistent with your storage files. As the production database seems still to be there, maybe you deleted /var/lib/mysql local files, but mysql thinks that the deleted database is still at its place.

It's safe to stop and start mysql service when you make changes to your filesystem. Also it's safer to make changes on a database through queries in place of shell commands.

Seavel
  • 93
  • 7
  • I stopped at 1. the beginning of mysql, 2. then delete the local files, 3. run of mysql. Base stopped output at: `show databases` and stopped output in `information_schema` – Nikita May 06 '14 at 18:19
  • In that case, was your crashed database named **production**? – Seavel May 07 '14 at 09:15
  • Yes, it was named production – Nikita May 07 '14 at 09:56
  • So i can assume this other question/answer could explain your problem: http://stackoverflow.com/questions/3302476/mysql-1050-error-table-already-exists-when-in-fact-it-does-not – Seavel May 07 '14 at 10:44
0

Is the database listed in SHOW DATABASES;? If so, try to DROP DATABASE and do the import after this.

Khamyl
  • 398
  • 2
  • 12
  • this database is not displayed when the `show databases;` Further I did: `mysqladmin create dbname;` `mysql-uuser-p dbname < /root/dumpfile.sql` and there was an error contained in the top – Nikita May 06 '14 at 10:05
  • Ok I have one more idea that may help: try to create a desired database, select it 'use db_name;' and 'flush tables;' – Khamyl May 06 '14 at 10:51