Amarok和Mysql二三事

csslayer | 2011/01/18

最近我自己的发行版的mysql将要升级5.5.8,这也引出了一些问题。主要是5.5.8的一个bug将导致Amarok无法正常启动,不过Fedora已经释出了一个patch解决这个问题,我在Archlinux上也测试通过。

导致我不得不顺便研究了一下Amarok和mysql的备份和导入导出。

说起来,我Amarok当中最宝贵的数据无非就是我对超过1000首歌的打分和封面了,在Amarok 2还有点杯具的时代,我没少重新给歌打分过,基本上是通过动态播放列表设置成打分在0.5分以下进行过滤,边播放边打分,总体需要几天的时间。

事实上,由于Amarok使用的是mysql,mysql的数据库备份方式对Amarok来说也是适用的。

备份数据库除了直接备份数据文件之外,还可以采用mysqldump这一工具。

首先关闭amarok,通过下面的命令启动mysql。

#!/bin/sh
cd ~/.kde4/share/apps/amarok
mysqld --defaults-file=`pwd`/my.cnf --default-storage-engine=MyISAM \ 
--datadir=`pwd`/mysqle --socket=`pwd`/sock --skip-grant-tables

这样一来mysql就像普通的数据一样启动了,然后你可以使用mysqldump进行备份,

mysqldump -S sock amarok > amarok.mysql

其次,就是迁移到一般的mysql服务器的过程,对于各个发行版mysql服务的安装,这里就不详细讲述了,假设已经启动了数据库之后。

首先在Amarok的设置里面,根据其中的语句创建好数据库和用户。

如果不幸遭遇Amarok的bug,导致Amarok无法启动,那么你可能需要手动配置~/.kde4/share/config/amarokrc

[MySQL]
UseServer=true
Database=amarok
Host=localhost
Password=mypassword
User=amarokuser

然后执行:

mysql -u amarokuser -p amarok < amarok.mysql

就可以把原有数据库内容导入到系统的mysql当中了。
=-=-=-=-=
Powered by Blogilo

Tags: ,

2 FEEDBACKS

Leave a Reply to L42y Cancel reply

Your email address will not be published. Required fields are marked *

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).

This site uses Akismet to reduce spam. Learn how your comment data is processed.