Speed up Amarok with MySQL

  • October 20, 2007
  • Avatar for peter
    Peter
    Upfold

Amarok logo So you've got a MySQL database server set up and running and you use Amarok for your music. You'd think those two things are quite separate from each other and wouldn't really combine right?

Now Amarok is a brilliant music jukebox and player and one of its features is that it can use several different types of database to store your music information. One of the database backends it supports is MySQL.

The major benefit of configuring your Amarok to use MySQL instead of the default SQLite is speed. MySQL is a dedicated database system, so if you happen to be running it on your machine anyway (for example if you a have LAMP installation), you may as well take advantage of it.

UPDATE: there is debate as to whether this increases performance or not, but it's still worth a try. YMMV.

A quick word of warning - this process will involve clearing out your current library, meaning you will lose play counts and other metadata (but not any of your music) from your library when it is recreated in MySQL form.

So the first thing we need to do is create a new database for Amarok to store its data and set up a user to give it access. You do this in the standard MySQL way:

$ mysql -u root -p
Password: [[enter MySQL root password]]

Once you're logged in, let's go for it:
mysql> CREATE DATABASE amarok;

Next, let's create a user and give it permissions to the Amarok DB:
mysql> GRANT ALL ON amarok.* TO amarok@localhost IDENTIFIED BY "amarokPassword";

Obviously, you'll want to replace amarokPassword (not including the quotes - keep them wrapped around your password) with a better password of your choice.

Now that's done, we need to open up Amarok, so do that now. Go to Settings > Configure Amarok and click on Collection on the left.

Configure Amarok dialogue box

Select MySQL under Collection Database and enter the username, password and database name that we set up a moment ago. On clicking OK your old collection will disappear and the new one will be built.

If for some reason it won't rebuild automatically, you can manually kick it into action by going to Tools > Rescan Collection.

And there you go - Amarok, powered by MySQL!

Avatar for peter Peter Upfold

Home » Articles »