Archive for the ‘MySQL’ Category

Data Normalization Rules

Wednesday, May 19th, 2004

The 5 Rules of Data Normalization are quite handy when you’re creating any sort of a database.

The rules are:

# Eliminate Repeating Groups
# Eliminate Redundant Data
# Eliminate Columns Not Dependent On Key
# Isolate Independent Multiple Relationships
# Isolate Semantically Related Multiple Relationships
# Optimal Normal Form
# Domain-Key Normal Form

Quite the facinating read. Good stuff, if you’re into databases at all.

Securing MySQL

Monday, March 15th, 2004

Securing MySQL: step-by-step, from SecurityFocus, is a very good tutorial.
From installation to removing the history, to securing admin and removing users, they cover it all. If you use MySQL, you need to read and follow this.

Relational Database Guidelines

Thursday, June 5th, 2003

Dr E.F. Codd first developed the relational data model back in 1970. Later, in 1985, he published a list of 12 rules that would define an ideal relational database.

Here are those rules. The article goes into detail on each of these rules.

# The Information Rule.
# Guaranteed Access Rule.
# Systematic Treatment of Null Values.
# Dynamic On-Line Catalog Based on the Relational Model.
# Comprehensive Data Sublanguage Rule.
# View Updating Rule.
# High-level Insert, Update and Delete.
# Physical Data Independence.
# Logical Data Independence
# Integrity Independence
# Distribution Independence
# Nonsubversion Rule

Weird JSP and MySQL Error

Wednesday, May 28th, 2003

I was trying to run a query and get the Max ID of the ResultSet.

ResultSet rs = stmt.executeQuery("SELECT max(userid) " +
                                   "FROM answers");
	while (rs.next())
	{
		nid = rs.getInt("userid");

What was happening was that I was getting an error Column userid not found. Which was really odd, because the column was there.

Thank God for the Java Forums, because what I had to add in the last line was:

nid = rs.getInt(1);

Not sure as to why this is. But it works. Properly. Either an oddity of JSPs or MySQL.

Starting MySQL from a Terminal

Tuesday, May 27th, 2003

I am always going to the MySQL Manual because I’ve forgotten some little thing. Like to start the damn thing. Because I’m not in MySQL all the time, I don’t want it running all the time. But when I go to login into it, it’s not running, and the command to start it has just fled my head. Every single time.

So here it is, for Mac OS X.

shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe
(Enter your password, if necessary)
(Press CTRL+Z)
shell> bg
(Press CTRL+D to exit the shell)

You should now be able to connect to MySQL by running '/usr/local/mysql/bin/mysql'.

Describe MySQL

Tuesday, March 25th, 2003

Okay. I admit it. I’m not a MySQL guru. I’m basically a newbie. Particularly with command-line interfaces to my database.

Anyways, I needed to get a “dump of my databases information(Getting information about your MySQL Database Documentation)”:http://www.mysql.com/doc/en/Getting_information.html. Here’s how you would do it.

DESCRIBE tablename where tablename is the name of the table you’re interested in. Complicated eh?

MoveableType MySQL Database Structure

Friday, March 21st, 2003

When I was “rebuilding my site(cause it all went away)”:http://www.simiandesign.com/blog-fu/2003/03/001457.cfm, I was running into problems trying to initialize the MySQL DB. I was running mt-load, but it was crapping out on me. (I was using the flat-file format before).

So I ran across “this lovely site”:http://www.emptypages.org/ which provided me with the code needed to create the MT DB I was running mt-load in MySQL. A lot of tables. But very useful. It covers MoveableType up to version 2.63.

Or look at the mysql.dump schema in the MoveableType folder. It is all there. (thanks “David(David Collantes)”:http://www.collantes.us/)

Now, this is not what I needed in the long run. I needed to delete the MT Directory and start from complete scratch.

My Hero…this week.

Thursday, March 20th, 2003

“Noel Jackson”:http://noeljackson.com/ is my hero for this week. Maybe next week, if someone doesn’t come up strong(er).

In reponse to “my problems with this blog(problems, hell. A Raging Pain In The Ass. ARPITA)”:http://www.simiandesign.com/blog-fu/2003/03/001457.cfm , he left some brilliant comments that I was brainless to doing.

Noel stated:
“If you are using unix, just run this as a cron job…
curl -d username=yourusername -d password=yourpassword -d blog_id=3 -d __mode=export "http://noeljackson.com/cgi-bin/mt.cgi" -o ~/Sites/Backups/noeljackson.com/Databases/mtbackup.cgi

So, “Noel”:http://noeljackson.com/, you’re my hero, until March 26th. At which point I’ll have to re-evaluate things. Yea Noel!

MySQL: growing in popularity

Wednesday, March 19th, 2003

CNN.com has an interesting article on MySQL, and how it’s growing in popularity, how it’s poised to take market-share away from the big boys (Oracle, Microsoft, etc.), and how they plan to make it big.

This is defintely a feel-good article about MySQL.

Complete MySQL

Wednesday, February 12th, 2003

Complete MySQL from aaronfaby is a very thorough and easy to use distribution of MySQL for Mac OS X. It includes the full-on MySQL, a Preference Pane for administering the MySQL server, drivers, Install Guide, and full-on manual. I’m fairly interested in the preference pane administration myself. I don’t mind using Terminal to administer MySQL, but if it’s easier and quicker, then it’s worth a look.