Archive

Posts Tagged ‘redmine’

Restore MySQL database without a mysqldump backup

September 6, 2011 2 comments

Restore the database

I have had a hard disk error and I need to restore my old redmine database to the newer installation of redmine in Ubuntu 11.04 (https://myotragusbalearicus.wordpress.com/2011/09/05/install-redmine-with-mysql-in-ubuntu-11-04/).

I have the old data directory accessible, but no recent mysqldump of my database, so I just want to copy the old data directory to the newly created redmine database.

First, I take a backup of the current version:

$ mysqldump -u root -p'root_password' redmine | gzip > redmine_mysql.gz

Shutdown the database:


$ sudo service mysql stop

Delete all of MySQL database files (with root user or mysql user):


$ sudo su -

$ cd /var/lib/mysql/

$ rm *

Install a new empty database schema:

$ mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h <machinename> password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/scripts/mysqlbug script!

Start the database and then assign a password to the root user:

$ sudo service mysql start
$ mysqladmin -u root password 'new-password'

Shutdown again the database, and copy all of the files of the old filesystem to the newly created database, overwriting all the files:

$ sudo service mysql stop
$ sudo su -
$ cp -R /old_file_system/var/lib/mysql/* /var/lib/mysql
$ chmod -R 660 /var/lib/mysql/

And finaly, restart the database:

$ sudo service mysql start

Permissions error

If you get this error selecting tables:

mysql> select * from attachments;
ERROR 1017 (HY000): Can't find file: './redmine_default/attachments.frm' (errno: 13)
mysql>

Ensure that you have the propper permissions in the data directory and that belongs to mysql user.
In my case, the data files has the correct permissions:

$ ls redmine_default/attachments.frm
-rw-rw---- 1 mysql mysql  9022 2011-09-06 00:02 attachments.frm

But the directory not:

$ ls redmine_default
drw-rw----  2 mysql mysql     4096 2011-09-06 00:02 redmine_default/

The directory needs 770 permissions:

$ sudo chmod 700 redmine_default

Rollback changes

If something goes wrong, and you need to restore the initial backup, you have to do this:

$ gzip -c -d redmine_mysql.gz | mysql -u root -p redmine

Restore redmine attachments

The attachments are installed under /var/lib/redmine/default/files. To back them up run the following:

</pre>
<code>$ sudo tar zcPf redmine_attachments.tar.gz /old_file_system/var/lib/redmine/default/files</code>

And to extract to the new location:

<span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; white-space: normal;">$ sudo tar xvPf redmine_attachments.tar.gz</span></pre>
Advertisements

Install redmine with MySQL in ubuntu 10.10

March 22, 2011 3 comments

Again with Redmine ;-D

As you can read in my older post about installing redmine with PostgreSQL (https://myotragusbalearicus.wordpress.com/2010/11/17/install-redmine-with-postgresql-in-ubuntu-10-10/), now at home I’ll give it a try with MySQL, as I’m developing a web page with PHP/MySql.

The steps are basically the same, followed the indications of this link:

http://www.redmine.org/wiki/redmine/HowTo_Install_Redmine_in_Ubuntu

I only have had to install and enable the passenger mod for Apache:


$ sudo apt-get install libapache2-mod-passenger

Then, I can access to localhost/redmine, and don’t forget the admin/admin user/password!

Install redmine with postgreSQL in ubuntu 10.10

November 17, 2010 1 comment

I’m looking for a issue tracking system and finally I’ve dicided redmine to give a try. I’ve been testing a little bit (a couple of days) with Jira, Trac and Mantis. I’ve finally decided Redmine because:

– Jira is a good option, a lot of people recommends it, but it’s propietary (altought it’s free for open source projects), but the standalone version lacks a lot of addons that are only available on the hosted (payment) version. In my case I can go on with the standalone version,  but I decided to give a try an open source product.

– Trac seems to be a good choice, but I’ve read some posts saying that it’s developement is slooower.

– Mantis, another interesting choice, but I found the navigation very confusing.

– Redmine: my actual decission. It’s an evolution of Trac, with a good and integrated admin module. I’ll post about my impressions when I’ve been tested it more.

To install it,first you have to install mySQL or postgreSQL. I’ve decided to install postgreSQL 9 (the latest version). You need the PPA in order to install it on Ubuntu 10.10:
https://launchpad.net/~pitti/+archive/postgresql

$ sudo apt-get install postgresql-9.0 pgadmin3

Then, to install redmine I’ve followed this link:

http://www.redmine.org/wiki/redmine/HowTo_Install_Redmine_in_Ubuntu

But when I configure apache I can only see the directory listing of /redmine. Thus, I installed these packages (I don’t think I need all of them, but this worked for me):

sudo apt-get install ruby rubygems subversion ruby-pkg-tools ruby1.8-dev build-essential

sudo apt-get install libapache2-mod-passenger

Then I tried to configure redmine using passenger and voilà, I can access redmine!