MySQL : Installing the Employees Sample Database (and setting Environment Variables for both SQL Server & MySQL)

You can install the EMPLOYEES sample database at https://launchpad.net/test-db/. (Also see https://dev.mysql.com/doc/employee/en/index.html for instructions). I faced a few issues when trying to install it, so I am detailing the steps and solutions so that you can avoid the same!

First up, I downloaded the latest version (seen on the right hand side of the page, in the Downloads section) and unzipped it. But I didnt see the employees.sql database script there. So I downloaded an older version also : employees_db-code-1.0.6.tar.bz2. This proved useful later.

The MySQL documentation stated :

  • To import the data into your MySQL instance, load the data through the mysqlcommand-line tool:
  • shell> mysql -t < employees.sql 

Ok, that didnt work out. I can get the MySQL prompt by  going to C:\Program Files\MySQL\MySQL Server 5.6\bin and then typing in :

–Mysql –u root –p

But thats not the issue here. I need to access the mysql prompt from a different path; namely the path where I have unzipped the Employees database scripts.

As expected, you have to set an environment variable. Take Control Panel> System> Advanced System Settings > Advanced> Environment Variables > System variables> Path> Edit. Note that we already had SQL Server path here. So prefix the MySQL path using a semicolon so that it doesn’t overwrite it.

For me, that path now reads (among others):

C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\MySQL\MySQL Server 5.6\bin

So now close your command windows. Take a new cmd prompt, browse to your zip file location and type in :

–mysql -u username -p -t < employees.sql

Now I got an error like this :

ERROR at Line 108 : Failed to open file ‘load_departments.dump’, error: 2.

That means the file was missing. This is when I copied the older files of the previous download to this folder. Now run the command again and it will successfully install all the databases.

I hope this small article will benefit someone out there. Tx.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s