How To Use MySql Database in Amarok
By default, Amarok uses SQLite to maintain the library and other data such as ratings, play-counts etc. However, Amarok also comes with support for MySQL databases, although it is not enabled by default. With larger library (like mine which is around 50GB) I find that using MySQLis faster than when using SQLite. So, here is how you use MySQL in Amarok instead of the default SQLite.
Install MySQL
First make sure that you have MySQL installed, You can do this by opening the Terminal and executing the command "mysql" (without quotes of course!). If you get a command not found error, it is not installed. So, install it with the command below:
sudo apt-get install mysql-server mysql-client
Make sure you remember the password you set during the installation.It will be the root password for your MySQL installation.
Create New User and Database
Now that you have installed MySQL, you need to create a new user and a new database for Amarok to use.
But first you need to connect to your MySQL server as root. To do this open the terminal and execute:
sysql -u root -p
Enter the root password you created at the time of installation and you are connected.
Then, create a new user, say "amarok" with password "password", using the command:
NEW USER 'amarok'@'localhost' IDENTIFIED BY 'password';
Then create a new database for Amarok to use. Let us call this "amarokdb".
CREATE DATABASE amarokdb;
After creating the database, we need to make sure that user "amarok" has all previleges in the database.
GRANT ALL ON amarokdb.* TO 'amarok'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Close the connection with the command
quit;
and then close the Terminal.
Configuring Amarok
The part about the database is over now and Amarok needs to be configured to use the database we just set up. This is much simpler that the above steps.
Open Amarok and go to Settings -> Configure Amarok. Go to Database and check the box next to Use external MySQL database and enter the details as shown below:
Server: localhost
Port: 3306
Username: amarok
Password: password (or whatever you picked above)
Database: amarokdb
Click on Apply and then Ok.
Now Amarok will rescan your library and this time it will use the MySQL database.