Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

PS: I'm sorry my description is a bit long. I am just trying to give all the information.

At first, I was not able to login to direct admin. I research on the web on what are the causes and found out that directadmin cannot make sessions when the disk is full. I check through ssh and found out that the root directory was indeed full. To be able to login to directadmin and start mysql, I decided to add a soft link of the /var/lib/mysql/ to /home/mysql. Since my database used up the most of the root directory. I move first the /var/lib/mysql to /var/lib/mysql.mark before I created the softlinks. Then move the file from /var/lib/mysql.mark back to /var/lib/mysql.

But still I cannot login through directadmin. I also decided to add a softlink for the directadmin sessions to /home/sessions. Still I it did no allow me to login. When supposed to be it has enough space to store the session data.

Then I notice that some of my databases where not on /var/lib/mysql directory exactly. Instead I find it on /var/lib/mysql.backup directory. I find it odd though I copy /var/lib/mysql/mysql.backup to /home/mysql_backup. And remove /var/lib/mysql/mysql.backup. Thinking it is the backup anyway. Just to clean the disk storage. I also remove the softlinks since I have enough room. Still it did not allow me to login. And found out that mysql is not running and I cannot start it. By this time, I know I have made quite a messed.

Fortunately, I was able to start mysql after asking for help here. It is solve by removing /var/lib/mysql/ibdata1. Since it is the cause of the problem, I guess it is corrupted. Next problem was I cannot login to mysql in terminal. I received access denied for my user account. Luckily, someone help me. I add skip-grant-tables to my.cnf file and restart the service. I was able to view the mysq.user and notice that the db users, for directadmin and for the database I created using directadmin, are not present in mysql.user. When I view the databases present on mysql, my databases are missing.

So I have these following questions:

  1. How can this be that some of the users are missing?

  2. Is the db user stored in another table when it is created using phpmyadmin from directadmin.

  3. What happened to my databases?

Lastly can I restore my databases by just copying from the backup I made before I added the softlinks. I mean copy the /home/mysql_backup to /var/lib/mysql. Since I saw in the /home/mysql_backup the databases I created as well as the mysql default databases.

Is it possible to restore my database using the following steps. The steps are based on this article

  1. shutdown mysql.

  2. Make a copy of /var/lib/mysql /var/lib/mysql.orig

  3. rsync or copy the new files into place. sudo rsync -av /home/mysql_backup/ /var/lib/mysql/.

  4. sudo chown -R mysql: /var/lib/mysql and then start mysql.

I'm sorry my description is a bit long. I am just trying to give all the information. Please enlighten me what I am going to do.

share|improve this question
add comment

1 Answer

I can't explain everything here as there is a lot of work done from you and things are pretty messed up and without looking on them, one can't answer what and how all that happened.

But I can suggest the fix for this, though a obvious one, but still.

First make enough space in your root filesystem.

The move the main copy of your database, which you copied in the starting as /var/lib/mysql.mark back to /var/lib/mysql.

And simply restart your mysql.

There are pretty good chances (hoping that copy of mysql is still untouched), that your DB will be restored to the previous state.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.