RE: Restore mysql database backup to new Sentora
09-06-2019, 12:59 AM
(This post was last modified: 09-06-2019, 01:12 AM by kevwebbie.)
(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.