mysql

Accidently hosed a post last night

I accidentally hosed a post last night. I was trying to delete an attachment to a post but instead deleted the entire post. Luckily I have nightly backups, so restore was quick and easy. It was the first time in a LONG time that I've had to restore the database, but I am extremely relieved that my backup system is working perfectly. I also rsync the backups to my home computer they are stored in two different places.,

Hibernate-3.2.x/JDBC-3.1.x Does Not Work With MySQL 4.1.x

I just spent six hours today trying to figure out why the Hibernate example I set up and the example in the "eg" directory of the Hibernate binary distribution both did not work. The example I made was doing something really simple, filling in 3 attributes in a table. It was putting in garbage instead. The "auction" example that comes with Hibernate (in the "eg" directory) would just cack, leaving me with all sorts of confusing log messages.

Since the "auction" example worked at my work computer so I thought about what was different on that computer. I then thought that my work computer might have been using mysql-5, while my home computer is still using mysql-4.1.x. I had tried upgrading to mysql-5 a few months ago but it didn't work for some reason. I tried following the instructions for upgrading mysql on gentoo again and they worked flawlessly. I tried running the hibernate auction example by typing ant eg and it worked. Next I tried running the example I made myself and it worked as well. Finally, 6 hours later, and it looks like the solution was to upgrade to mysql-5.x.

I have no idea why mysql-5.x works but mysql-4.1.x would not. I would be surprised if my example or the auction example were making use of any new mysql 5 features. It's been a painful day, but at least it is fixed now. Now I can finally continue working to understand Hibernate.

Backing up MySQL Databases With AutoMySQLBackup

I just discovered a very useful bash script tonight, AutoMySQLBackup. It is a nice and easy way to backup your mysql databases daily, weekly, and monthly. It was very easy to set up and works great. A great suggestion to prevent having to put the username and password for a database user with read/write access in the script is to do the following:

mysql -u root -p -e "GRANT SELECT, LOCK TABLES ON *.* TO 'backup'@'localhost' IDENTIFIED BY 'backupPW';"

That creates a database called backup with password backupPW with only SELECT and LOCK TABLES access to the database. This tip came from this gentoo-wiki.com article on MySQL backup.

Subscribe to RSS - mysql