Setting up a MySQL server

Note that the department now has a central, departmentally managed SQL server that you may use. Just send email to to ask about having a database set up for you on this server.

Or, if you prefer to set up and run your own mysql server, continue with the instructions below...

  1. Create a .my.cnf file in your home directory with information about where you'd like your configuration and data files stored:
  2. Create the datadir defined in your .my.cnf file if it doesn't already exist:
      $ cd
      $ mkdir mysql 
  3. Initialize the database.
      $ mysql_install_db
  4. Set a password for the MySQL root user. If you don't perform this step, anyone with access to the running database daemon has full control over the data in your database!
      $ mysqladmin -u root password 'NEWPASSWORD'
  5. Start the MySQL daemon
      $ mysqld & 
...and you should be good to go.


For our backup system to backup the database, a mysqldump must be performed. See this link on how to user mysqldump:

There are different versions of MySQL available on most department operating systems. Take a look in /usr/local for the one you need and run it explicitly if the default isn't what you want:
  $ ls -d /usr/local/mysql*

  $ /usr/local/mysql-5.1.35/bin/mysqld &

If you get errors about port 3306 already being bound, someone else is running a MySQL server on that machine on the same port. You'll need to choose a different port. This can be done from the command line when running mysqld:

  $ mysqld --port=3307
or it can be done from the .my.cnf file:


See also the MySQL setup documentation.

See also the full MySQL documentation at