Press "Enter" to skip to content

MySQL server – logs and data – standardizing links

We manage a lot of different servers, mostly web application servers running PHP and MySQL.

The physical layout of these systems, due the hardware involved, often is quite different from server to server. As a result the placement of the data repository and binary logs and other log files is not the the same.

I got tired of having to track down where each of these items were located, so I started using the following structure where possible. If not possible, these same items existed, but were merely symlinks to the actual locations.

/var/mysql

  • mysql.sock – just a symlink to /tmp/mysql.sock. This was due to a minor config issue Apple had in OS X Server 10.4, that they finally corrected.
  • binlogs – the binary logs generated if this system is intended to be a replication master
  • data – link to the actual location of the datadir

/var/log/mysql

  • error.log – the error log for the machine. I never liked how mysql named the error log after the hostname. Now, I’m telling it, use this name
  • slowq.log – slow query log

Now all the items that I normally need to get to, have easy to remember, standardized “locations”.

I’m sure this is old hat for some. Sometimes it takes me a while to figure out the simple stuff. 🙂

2 Comments

  1. sanderw
    sanderw March 11, 2007

    How are you enforcing this standard? Just by practice or are you looking at configuration managers like cfengine or rsh scripts?

  2. Brian Blood
    Brian Blood March 18, 2007

    Nothing really to enforce. I’m just creating a set of aliases to where ever the items are located on that particular server and storing those links in the same place on every machine.

Leave a Reply