5 February 2010

MySQL Setup Instructions

If you're wanting to setup a MySQL database on your computer, personally I would recommend installing XAMPP, which you can download from here:

XAMPP includes PHP, MySQL, phpMyAdmin and several other handy programming languages which help setup your own server (and even webserver). phpMyAdmin makes it really easy to configure and manage databases, tables and relations.

There is also a specific version for Mac too which is slightly more lightweight:

You can also use MySQL Workbench to help you design your database, create ER diagrams, and also reverse AND forward engineer your databases to/from models. MySQL Workbench also helps *a lot* if you are trying to add Foreign Keys to your database - but using phpMyAdmin works fine too.

MySQL Workbench: http://wb.mysql.com/

However, if you would rather just install MySQL Server, here are some instructions I've put together which may help you set it up too.

If you have made a database in phpMyAdmin and want to set it up just on MySQL, here are the instructions on how to import it back.

To use a newer version of the database, delete the existing database:

mysql> drop mydb;

Import newer version:


USE mybd;

\. C:\mydb.sql (this is the path to your exported SQL file)

More MySQL Commands: http://www.pantz.org/software/mysql/mysqlcommands.html

If you have trouble logging onto MySQL and need to reset your password: http://lists.mysql.com/mysql/171366

Follow these instructions better:

  1. Manual stop: go to run, type services.msc; find the service name, right-click it and click Stop.
  2. Go into C:/Program Files/MySQL/MySQL Server 5.1/bin/
  3. Right-click the mysqld.exe file and create shortcut
  4. Right-click the shortcut, go to properties, and in the path, add on the end (don’t need quotes): --skip-grant-tables
  5. In MySQL command line prompt issue the following command:
  6. mysql –u root mysql
  7. UPDATE user SET password=PASSWORD("abcd") WHERE user="root";
  9. At this time your root password is reset to "abcd" and MySQL will now know the privileges and you'll be able to login with your new password:
  10. mysql –u root –p abcd mysql

Importing the database:


To test your databases have been imported:

mysql> show databases;

mysql> USE mydb;

Alternatives to XAMPP: