Targeting a single database with these options:
mysqldump -u MY_DB_BACKUP_USER -p MY_DB_NAME --add-drop-table --add-drop-database > my_db_name_mmddyyyy.sql
will successfully backup the database, but if you were to restore the database backup file back into a database with a newer schema (additional tables for example) like so:
mysql -u my_db_access_user -p MY_DB_NAME < my_db_name_mmddyyyy.sql
you would end up with a “merged” version of the database that would have new tables from the more recent schema and restored tables from the backup:
I learned this the hard way recently when attempting to restore a database to an earlier version following a failed Redmine 3.0.2 upgrade. While this didn’t break anything (other than maybe a future upgrade attempt that doesn’t properly handle existing tables), it wasn’t what I intended.
Going forward, if I want to backup a single database and have the backup file contain the statement necessary to first drop the database before restoring it (a full restore for example), I’ll need to call the
mysqlbackup command like so:
mysqldump -u MY_DB_BACKUP_USER -p --databases MY_DB_NAME --add-drop-table --add-drop-database > my_db_name_mmddyyyy.sql
--databases statement. If you didn’t know this, I hope it helps you from making the same mistake.
Even when hope is in short supply.
Here’s hoping it is a good one.
Just found out the wife registered the cats’ birthdays so she would get free ice cream coupons.
Running into cryptic errors really sucks, and this was certainly no exception. We had a Windows share provided to us that we wanted to mount to an Ubuntu 10.04 LTS server for general storage.
After reading the Ubuntu MountWindowsSharesPermanently wiki page and consulting the smbmount man page I came up with this new (initial)
//192.168.1.5/test-smb1 /mnt/it_hosted cifs credentials=/root/it_hosted_windows_share_mount.conf,iocharset=utf8,sec=ntlm2 0 0
/root/it_hosted_windows_share_mount.conf file contained:
I’ve substituted values of course. One thing to note is that if
example.com were the real domain, I’ve made sure to use
example as the value.
Then came the
mount error (13): Permission denied error. I tried from a Windows box and was able to connect fine, so I knew that the server/share wasn’t the problem.
I then decided to call
mount directly as shown here. After getting that working, I rechecked the syntax used in
/etc/fstab and then finally looked at
What do you know, the old & much despised EOL issue. After changing the DOS EOL to UNIX everything worked. I can’t count the number of times I’ve been bitten by that.