Amarok Optimized using MySQL

For those who love using the audio player giant… I have created this. Most of the time I use XMMS as if it was embed it within me. I use XMMS most of the time because it’s very lightweight, simple to use and always been a windows replacement of Winamp for me. But this fact doesn’t rule out that I don’t use Amarok. I enjoy using amarok because of it’s pretty awesome interface, sorting of songs, OSD and it’s support for xine. But there’s one thing about Amarok that bothers me a lot; If you are a heavy music listener the performance of Amarok becomes degraded due to the fact you might have too many songs to sort and changing songs become a burden with lag…. So in this brief tutorial I will try to help you solve this slight problem.

If you don’t already know by default Amarok uses it’s own database system to store your song info (i.e. id3, album art and etc) which is stored in a file. Reading and writing to this file with collection of thousands, gets ridiculous. So how can we fix this? Well there is other database support for amarok, which are SQLite, MySQL, and PostgreSQL which is nice. Since MySQL is widely used by the *nix community this tutorial will based on MySQL.

First off get MySQL for gentoo!

  • emerge –ask –verbose mysql

or get the binaries/source from your distro

Configure it…
use

  • “emerge –config =dev-db/mysql-[version]” (replace the [version] with your version)

Start it…
use

  • /etc/init.d/mysql start

Set a Password for the Root db Acc..
use

  • /usr/bin/mysqladmin -u root -h localhost password ‘mYsUpeRcRaZyPa$$word’
    (set it to any thing you want, just remember it..)

Setting up the Database for Amarok to use

in the terminal type:

  • mysql -p -u root

(insert your very cool password for your root MySQL db acc)
and in the mysql prompt use these commands to the make the amarok db

  • CREATE DATABASE amarok;
    USE amarok;
    GRANT ALL ON amarok .* TO amarok@localhost IDENTIFIED BY 'IAMTOOLAZYTOCHANGETHISDEFAULTPASSWORD';
    FLUSH PRIVILEGES;

Setting up Amarok to use MySQL

Okay we’re getting there..
Gentoo Users must add mysql support to amarok by echoing/editing package.use
So you can do that by typing

  • su
    (type your root password)

then type

  • echo ‘media-sound/amarok mysql’ >> /etc/portage/package.use

and then recompile by using

  • emerge -av amarok
    (and make sure mysql is highlighted! before compile)

Configuring Amarok to use Mysql database

Open up Amarok and click settings -> Configure Amarok in the menu bar
Find Collection and put these settings
Use the following settings:

Hostname: localhost
Database: amarok
Port: 3306
Username: amarok
Password: IAMTOOLAZYTOCHANGETHISDEFAULTPASSWORD

And hopefully you should see a great performance over your old amarok ;)

Reference Links:

http://amarok.kde.org/amarokwiki/index.php/MySQL_HowTo

http://mikesubuntu.blogspot.com/2007/09/how-to-set-up-mysql-database-in-amarok.html

http://www.gentoo.org/doc/en/mysql-howto.xml

Post up a Comment if you run into problems…