HOWTO: Amarok with MySQL database

From Sabayon Wiki
Jump to: navigation, search

If your MP3 collection is 10gb or larger, you will probably benefit from using MySQL as opposed to SQLite for your collection's database. It will take much less time to run Update Collection using mysql with a large collection and searching will probably be quicker as well. The proceeding will guide you step by step how to setup Amarok to use MySQL.

1. Of course, you will need both Amarok and MySQL server installed. If you do not, run the following command:

# emerge amarok mysql


Install the Ewwbuntu community repo Community_Repositories#Ewwbuntu and

# equo install amarok

NOTE:This only works for x86

2. Once you have either installed Amarok and MySQL, or verified they were already installed, you need to configure MySQL. The following command will install the MySQL database and you will be prompted to set the root password for MySQL configuration. The MySQL root password does not have to be the same as the root system logon password. The password you set will only be used for access your MySQL server databases

# emerge --config mysql 

3. After the database is installed, secured, and root password set, we need to start MySQL and set it to start at boot automatically.

# /etc/init.d/mysql start && rc-update add mysql default

NOTE: You should also run the following command to secure your MySQL installation.

# mysql_secure_installation

Since you already set the root password, you can say "no" when it asks if you want to change it again. Use the default answer for the rest of the questions to properly secure your MySQL installation.

4. Now that MySQL is running, we can setup the database for Amarok. To access the MySQL command-line tool, type the following:

# mysql -u root -p

It will ask for your password, enter the password you set earlier. You should now be at a prompt that looks like this: mysql>

5. At the MySQL prompt, enter the following commands:

mysql> CREATE DATABASE amarok;
mysql> USE mysql;
mysql> GRANT ALL ON amarok.* TO [email protected] IDENTIFIED BY 'passwordhere';
mysql> quit

Don't forget to include the ; at the end of each command, and be sure to replace passwordhere with your desired password for Amarok to access the database with.

6. Open Amarok, then in the playlist window click Settings > Configure Amarok. When the "Configure - Amarok" window opens, click the Collection icon on the left.

7. First, make sure your MP3 collection directory is checked in the "Collection Folders" section of this window. Then, at the bottom where it says "Collection Database" you will need to select MySQL in the Database drop-down menu. If you do not see the Collection Database section then you will need to remerge amarok with MySQL support.
The fields should be entered as follows:

Hostname: localhost
Port: 3306
Database: amarok
Username: amarok
Password: <password>

The password will be the one you set earlier for the amarok user, not the one you set for root. Once the fields are entered properly, click OK to save and exit the configuration.


8. Amarok is now configured to use its new MySQL database. Your Collection will be empty at first, so in the Amarok playlist window, click Tools > Rescan Collection. Once it is done building your collection, your database will be populated and you can enjoy a much faster database for your big MP3 collection.

--C0nv1ct 09:21, 18 May 2007 (PDT)