This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Restore mysql database backup to new Sentora
#1
Restore mysql database backup to new Sentora
Hi all,
I've been using Sentora for a long time and love it. Recently one of my servers which is hosting zpanel got corrupted. I needed to find a way to get the database files onto a new Sentora install. So far I have copied the databases via scp from the old server to the new server. I have also copied them into /var/lib/mysql on the new server so they are safe. BUT I can't find a way to make them show in Sentora so I can set up the websites again. I also can't copy the data into a new database which I created in Sentora.

Does anybody have any suggestions please? I'd be very grateful of any help. I am 95% of the way there. Just need to get these backups into Sentora.
Reply
Thanks given by:
#2
RE: Restore mysql database backup to new Sentora
Anyone have any input on how I can do this? ANY help would be appreciated.
Reply
Thanks given by:
#3
RE: Restore mysql database backup to new Sentora
(09-05-2019, 09:38 PM)kevwebbie Wrote: Anyone have any input on how I can do this? ANY help would be appreciated.

Okay, so I've managed to get this far:

(1) Copy the databases from the old server onto the new one into /var/lib/mysq/ by using:
$scp -r /var/lib/mysql/databasename root@serverip:/var/lib/mysql/  <-- Done on the old corrupt server onto the new server.
Then

(2) I changed privileges on the database to give mysql full access to same by logging into mysql:
$ mysql -u root -p *pass*
mysql> use database name;
mysql> show tables; <-- shows error due to privileges
mysql> GRANT ALL PRIVILEGES ON mydatabase.* TO 'mysql';
mysql> exit;
$ sudo service mysql restart
- Log into mysql once more
$ mysql -u root -p *pass*
mysql> use database name;
mysql> show tables; <-- Now mysql will show the tables

(3) So when I log into Sentora, I can log in to phpmyadmin as "root" (with root pass) and I will can the databases I've copied to /var/lib/mysql. I can also see the tables of the databases that I've granted permissions to mysql but not those of root.

Now I am left with attempting to view the databases within the "zadmin" login of my Sentora installation. I presume this will be done with the actual Sentora database? Maybe I need to grant privileges to the "zadmin" dbase user?

I'm hoping to get one of you Sentora exerts to answer the rest of my question maybe?


Update on this
Okay, I should have seen this earlier (Faceplant!). So now that I can connect to the databases via phpmyadmin in Sentora by logging in as root, I'm just going to export the databases to my local computer and then import them back into Sentora via phpmyadmin. Boom! I'm done! Simples!

Maybe someone else can use this info if they get locked out of a server or it gets corrupt. Smile
Reply
Thanks given by: TGates
#4
RE: Restore mysql database backup to new Sentora
Just a quick point on the above which I forgot to post. IF you can, it will be best to use mysqldump to dump the database into a .sql file on the first server, then move or download it to the next server or localhost. This will help maintain the consistency of the database. Moving the database files without using the dump can cause structural issues in the database with the ibdata, ibdata1 files. This can cause tables not to show. Use the mysqldump syntax shown below if you can access your server with root access.

$ mysqldump -u root -p *database-name* > *sqlbackupname*.sql
$ Enter mysql password: *your-mysql-password*

The above will create a database dump(backup) to a file called *sqlbackupname*.sql.
Then open your next server or your localhost and type the below to restore the database onto the server you want to move to:

$ mysql -u root -p *database-you-want-to-restore-to* < *sqlbackupname*.sql

I hope this helps someone in the future.
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Is Sentora dead? rajeevrrs 2 3 ,811 12-17-2022, 09:20 AM
Last Post: TGates
Sentora debug and error files johnnyp 0 1 ,515 10-27-2022, 06:16 PM
Last Post: johnnyp
Transfer Account to another Sentora BenI 1 3 ,207 07-21-2022, 07:19 PM
Last Post: Nigel

Forum Jump:


Users browsing this thread: 1 Guest(s)