• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

DB Error: Constraint Violation (After Overwriting Files in Horde)

My host suggested I copy and the files that contained my old data from the old directory:
/old/var/lib/mysql/horde/mnemo_memos.MYD
/old/var/lib/mysql/horde/mnemo_memos.MYI
/old/var/lib/mysql/horde/mnemo_memos.frm

To the new files in the new directory:
/var/lib/mysql/horde/mnemo_memos.MYD
/var/lib/mysql/horde/mnemo_memos.MYI
/var/lib/mysql/horde/mnemo_memos.frm

I overwrite these without making a backup and now I need help.

When I overwrote mnemo_memos.MYD I could still add notes via Horde webmail. Then, I overwrote mnemo_memos.MYI and mnemo_memos.frm and I get the following error when I try to add a note in Horde:
There was an error saving the note: DB Error: constraint violation

Can someone please help me just to get this working again. It would be a plus if I could also get my old data saved, too. Thank you.
0
EMB01
Asked:
EMB01
1 Solution
 
Daniel McAllisterPresident, IT4SOHO, LLCCommented:
Hmmmm...

Looks to me like you copied over the MySQL database while the database was active. Try this:

# Turn OFF the MySQL database server
/etc/init.d/mysqld stop
# Copy the old databases again
cp /old/var/lib/mysql/horde/mnemo_memos* /var/lib/mysql/horde/
# Restart the MySQL database server
/etc/init.d/mysqld start

I hope this helps!

Dan
IT4SOHO
0
 
EMB01Author Commented:
Dude, you're the man! I didn't know I had to shut mysqld off first and the host must not have know either (or they just didn't care to say...). Thanks, man! Now, I've got all my old notes and can add new ones.
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now