Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
deleting a database
 
bins
Jr. Member
 
Total Posts:  24
Joined:  2008-03-26
 

I want to delete a database, but I keep on getting the following appearing:
#1217 - Cannot delete or update a parent row: a foreign key constraint fails
and the relevant files are ‘stuck!

is this a mysql or db issue?

 Signature 

testacart.com
Compare carts before commiting

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
Joined:  2007-08-07
Los Angeles
 

I’d suggest to DROP DATABASE and then CREATE DATABASE if you do not have other than Magento’s tables in this database

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
bins
Jr. Member
 
Total Posts:  24
Joined:  2008-03-26
 

I cant.  The database is being shared with other bits

 Signature 

testacart.com
Compare carts before commiting

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
Joined:  2007-08-07
Los Angeles
 

In that case try running this before deleting tables:

SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKSFOREIGN_KEY_CHECKS=0;

and this after:

SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS,0);

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
bins
Jr. Member
 
Total Posts:  24
Joined:  2008-03-26
 

sorry to appear dim, but where do I run these from?

 Signature 

testacart.com
Compare carts before commiting

 
Magento Community Magento Community
Magento Community
Magento Community
 
Flowstack
Sr. Member
 
Total Posts:  130
Joined:  2008-01-30
London, United Kingdom
 

They are SQL commands.

Most hosts come with PhpMyAdmin (a web based database editor) which will allow you to input the commands and run them. Select your database, click on the SQL tab, enter the commands and click run.

Alternatively you can use something like SSH and the command line (PhpMyAdmin is much easier!).

 
Magento Community Magento Community
Magento Community
Magento Community
 
bins
Jr. Member
 
Total Posts:  24
Joined:  2008-03-26
 

this didnt work - still getting the error

 Signature 

testacart.com
Compare carts before commiting

 
Magento Community Magento Community
Magento Community
Magento Community
 
Flowstack
Sr. Member
 
Total Posts:  130
Joined:  2008-01-30
London, United Kingdom
 

With PhpMyAdmin you have to select all the tables and drop them all about 4 times until they all go.

You will get the error every time but the number of tables should decrease.

At least that’s what I found.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bins
Jr. Member
 
Total Posts:  24
Joined:  2008-03-26
 

I have also run the after comment and got:
#1231 - Variable ‘foreign_key_checks’ can’t be set to the value of ‘0’

 Signature 

testacart.com
Compare carts before commiting

 
Magento Community Magento Community
Magento Community
Magento Community
 
jofgav
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2008-04-09
 
Moshe - 26 March 2008 08:50 AM

In that case try running this before deleting tables:

SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKSFOREIGN_KEY_CHECKS=0;

and this after:

SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS,0);

This worked for me but I also got the message when running the query after:-

SQL query:

SET FOREIGN_KEY_CHECKS IFNULL( @OLD_FOREIGN_KEY_CHECKS )

MySQL saidDocumentation
#1231 - Variable 'foreign_key_checks' can't be set to the value of '0'

Is that a bad thing?

 Signature 

jof

http://www.gavjof.com
http://www.asyclan.co.uk
http://www.martialartsinstructionalvideos.us

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiaraweb
Guru
 
Avatar
Total Posts:  643
Joined:  2008-03-21
Aviano ~ Italy
 

I deleted so many magento db, if you select all tables and click on delete you receive that errors (but so many tables will be deleted), if you delete 1 table at once it works.
The tables that get errors are the first 4

Try to delete with “X” image x row and let me know wink

 Signature 

Non criticare cio’ che non puoi capire.
Bob Dylan

My Live Magento Shops
http://www.ecobaby.it
http://www.pesicampione.it

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiaraweb
Guru
 
Avatar
Total Posts:  643
Joined:  2008-03-21
Aviano ~ Italy
 
chiaraweb - 01 May 2008 01:30 AM

Try to delete with “X” image x row and let me know wink

the first 4 obviously not all

 Signature 

Non criticare cio’ che non puoi capire.
Bob Dylan

My Live Magento Shops
http://www.ecobaby.it
http://www.pesicampione.it

 
Magento Community Magento Community
Magento Community
Magento Community
 
jofgav
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2008-04-09
 

Thanks for your reply but I don’t get what you mean.

I have deleted all of the tables now (like Flowstack said in their post) it actually took a few times before they all went using phpMyAdmin.

What I am asking is now that all tables have been deleted, which I presume is because I ran the SQL query and not just because I tried deleting them several times, why doesn’t the 2nd query work and will this cause me any other problems in the future?

I’ve since then restored another database and cannot see a problem yet.

 Signature 

jof

http://www.gavjof.com
http://www.asyclan.co.uk
http://www.martialartsinstructionalvideos.us

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
52315 users|425 users currently online|105635 forum posts