Skip to main content

Recover Joomla PhpMyAdmin MySQL Database

This morning I found myself confronted with a new problem:

Our server crashed, we had to set it up again - from scratch. Fortunately, we did have some backups - the Joomla! files, and the mysql folder (on Linux: /var/lib/mysql).

(We are using a Linux server with mysql and phpmyadmin.)

I then tried to recover our database. What I thought: Just copy the contents from the database backup folder (mysql/joomla) to the mysql folder on the server and everything should be fine. That was what they said on the internet, too. Turns out there were only .frm files in that folder, no .myd etc. Turns out that .frm only contains the table structure. But where is my data?

Everything's not lost.

I found a huge file in the mysql backup folder, called ibdata1.

So what you need to do now is (instructions are for Linux):

- Stop your mysql service
  sudo stop mysql
- Copy that ibdata1 file to the /var/lib/mysql folder (consider making a backup of the existing ibdata1 file)
  cd /var/lib/mysql
  sudo mv ibdata1 ibdata1backup
  sudo cp <backupfolder>/ibdata1 /var/lib/mysql
- check that permissions are set to mysql as owner and group
- restart mysql service
  sudo start mysql
- if you set up any new passwords, check that Joomla! has the correct password in its configuration.php file for mysql.


Comments

Popular posts from this blog

Joomla! 2.5: Multiple views, one model

Here goes MVC again: I was a bit confused that every time I created a second or third view for a component, I had to create a separate model for it. Did not make sense to me - I had the necessary algorithms in the model for the first view, did I really need to do copy & paste? I hate it! Redundancy, redundancy, redundancy. That case occurred in my current project - I created user profiles and needed an "edit" view. The data is the same, but I need to have the data in editable text fields instead of fixed labels, and maybe some other buttons here and there...  Well, some time later I realized that I just did not quite understand what Joomla! acutally means by "view".  And that there is something called "layout". Long story short: If you have a model that provides all necessary information and you just want to have a different presentation of it, just add a new .php file to your views/<yourviewname>/tmpl folder - let's call it "layo...

Joomla / Eclipse: Use Eclipse to edit files

Even though I could use any Editor or Notepad, after some days of Joomla! I was yearning for some syntax highlighting and maybe even automatic code completion... I did some Java programming in the past, and I am really used to the Eclipse IDE. Eclipse IDE for JavaScript Web Developers seemed to be a good deal for what I was up to do, so I gave it a try. I feel kind of stupid even posting about this, but upon starting up Eclipse, I started to wonder how I would do that - being that Eclipse works with projects, and I didn't want to put all of my components into an Eclipse workspace, and I didn't want to put up a subversioning system. Turns out it is quite simple: Right-click somewhere in the package explorer,  select 'New', 'Project...'. In the dialog, open the folder 'General' and select 'Project'. Click 'Next'. For the name, I usually put the com_componentname / mod_modulename, as in my file system. But I don't think it matters....

Joomla! 2.5: Component as Article

Can you put a component on a page together with other articles? Like, for example, to have a component and a blog layout on the "Home" page? Yes, you can! There are some nice extensions that allow for this. I used the "Plugin Include Component" plugin, which is available on extensions.joomla.org . With this plugin, you simply create an article that contains a special tag, indicating the component to include. Just like this: Install the plugin and put the following code in whatever article you need it in (substitute 'componentName' and 'viewname' for your component's and view's name...). {component url='index.php?option=com_ componentName &view= viewname '}