My problem is: I'm saved the /var/www/virtual and the /var/lib/mysql directories. And after reinstall OS I set up the MySQL and when restored these two directories i'm got error in mysql server. So MySQL server don't want to start up.
So what way can i restore the mysql database directory?
The MySQL server don't start after I copy the ibdata1 file.
Related
my database server crashed on ubuntu 20.04, but unfortunately my database folders were containing only the .ibd files. the /var/lib/mysql folder was copied, then mysql was re-installed. I have followed so many answers on how to restore the databases here but nothing seems to work
I always copy a folder of MySQL db data into C:\ProgramData\MySQL\MySQL Server [x.x]\Data folder. And this db schema would appear after I restart the MySQL service.
However, this time I installed a new MySQL on a computer and followed the old way throwing MySchema folder into C:\ProgramData\MySQL\MySQL Server [x.x]\Data and restarted the service. It didn't work.
I checked my.ini datadir = C:\ProgramData\MySQL\MySQL Server [x.x]\Data.
What did I miss?
Edit:
I find a clue, my newly installed MySQL the table extension name is ibd, but my data table is frm, MYD and MYI.
I copied a database directory from the datadir (/var/lib/mysql/) of a MySQL instance running on a server to my local machine. Is it possible to put this database directory into my local MySQL datadir and access that database?
What I have done so far is copy the database directory like above, I log in to the MySQL and can see the database, I switch to it and can list all the tables. But when ever I try to query a table I get something like:
select * from users limit 1;
ERROR 1146 (42S02): Table 'users' doesn't exist
Also from mysqldump:
mysqldump: Got error: 1146: Table 'very_first_table' doesn't exist when using LOCK TABLES
Is it possible to do what I am trying to do here?
So I got it to work, bare in mind that my end goal was to get a database dump from the database. The mysql folder was extracted from a older virtual machine snapshot which could not be run at the moment, so I couldn't just log in to it and do a normal dump. Here is what I did:
1) I installed mysql on a fresh vm on my local machine
2) I shut down mysql with service mysql stop
3) I removed the existing /var/lib/mysql folder from the fresh install
4) I replaced it with the /var/lib/mysql folder that was removed from the old snapshot
5) I ran chown -R mysql:mysql /var/lib/mysql
6) I restarted mysql with service mysql start
7) Then I checked if I could log in and query the tables, I could!
So I was able to run the dump after that.
I had a problem with my hdd. There is a new system running in place and I found that I can mount and access the / of my old hdd (It had a Debian Linux distribution). However I forgot to backup some important data in the DB tables and I was wondering if there was anyway to execute a mysql server command from the mysql server installation in the mounted drive?
If your hdd contains complete OS, you can simply mount it and chroot to it. In chrooted environment start your mysql server and take data-backup with mysqldump command.
Or you can simply install mysql-server on your new system, change data directory option in /etc/my.cnf to the mounted partition, backup the data with mysqldump command. You can then revert the my.cnf change back.
My server recently crashed and I have backed the Mysql files using raid.
BACKED UP DIRECTORY
/backup/var/lib/mysql
I installed new OS(RHEL5.3) to my server and I want to restore my DB to MySQL
How do I do this?
I know you can ssh mysql > the dump files
but, these backed up files are not in DUMP.
They are separated as .MYD .MYI .frm etc..
I guess your backup file is not in the same server as your database.
Try:
scp -r /backup/var/lib/mysql/* DB_SERVER:YOUR_NEW_DATABASE_DIRECTORY
Then
ssh DB_SERVER
.. restart your mysql daemon (easier)
.. or flush privileges, flush tables ...
Copy these files directly to your mysql data directory, and you will be able to access them in MySQL. That should help you!