Store amaroK Data in MySQL
By default, amaroK stores information about your [music] collection including listening habits and rankings into a SQLite database file on your filesystem. If you only use amaroK on a single computer, this works fine, but if you run it on multiple computers you might want your information to be persistent across machines. amaroK supports the use of a MySQL database for this type of storage, but it does require a bit of a setup beforehand to use. This hack will describe the steps necessary to migrate to a MySQL collection database.
First, you need root access to a MySQL database to create a new database for amaroK. If you plan on accessing this database from anywhere, you will want to be on an Internet-facing machine that's always on. Log in to the database as root and create the initial database:
$ mysql -p -u root
mysql> CREATE DATABASE amarokdb;
mysql> USE mysql;
mysql> GRANT select, insert, update, delete, create, drop, create \
temporary tables, index ON amarokdb.* TO amarok@localhost IDENTIFIED \
mysql> FLUSH PRIVILEGES;
Replace password_here with the password you want to use for the amarok user. Now that the database is created, click Settings > Configure amaroK and then click Collection from the amaroK configuration window. Change the Collection Database Engine to MySQL and then enter the hostname for your MySQL database along with the name of the database (amarokdb in this example) and the username and password (amarok and the password you chose in this example) Click OK. amaroK will now start using the MySQL database to store its settings.
To import SQLite data into MySQL, the amaroK team created this method, which is not officially supported. First copy your ~/.kde/share/apps/amarok/collection.db file to your database server, and then type:
$ sqlite3 collection.db .dump | \
grep -v "BEGIN TRANSACTION;" | \
grep -v "COMMIT;" | \
perl -ne "s/INSERT INTO \"(.*)\"
VALUES/INSERT INTO \1 VALUES/; print" | \
mysql -u root -p amarok
This tech tip is excerpted from Linux Multimedia Hacks, authored by Linux Journal columnist Kyle Rankin. Published by O'Reilly Media, ISBN: 0-596-10076-0. Copyright 2006. For further information please visit http://www.oreilly.com.
|Non-Linux FOSS: libnotify, OS X Style||Jun 18, 2013|
|Containers—Not Virtual Machines—Are the Future Cloud||Jun 17, 2013|
|Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer||Jun 12, 2013|
|Weechat, Irssi's Little Brother||Jun 11, 2013|
|One Tail Just Isn't Enough||Jun 07, 2013|
|Introduction to MapReduce with Hadoop on Linux||Jun 05, 2013|
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- RSS Feeds
- Introduction to MapReduce with Hadoop on Linux
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Help with Designing or Debugging CORBA Applications
- Returning Values from Bash Functions
- Linux Systems Administrator
- Welcome to 1998
27 min 2 sec ago
- notifier shortcomings
50 min 44 sec ago
2 hours 27 min ago
- Android User
2 hours 29 min ago
- Reply to comment | Linux Journal
4 hours 22 min ago
7 hours 11 min ago
- This is a good post. This
12 hours 24 min ago
- Great, This is really amazing
12 hours 26 min ago
- These posts are really good
12 hours 28 min ago
- It’s a really great site you
12 hours 30 min ago
Free Webinar: Hadoop
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?