changed ownership on mysql files. How can I recover database? - mysql

I am using digitalocean VPS. Accidentally I changed all files' ownership to www-data on my server. How can I get my mysql database copy from this server?

No backups? MySQL files should be in /var/lib/mysql or /var/db/mysql... look around, you may be able to change the ownership of those files and get mysql to start again, dump the db and start anew on another machine.

I created a new vps with digitalocean and installed mysql.
Then copied file permissions and owners from new vps to old vps.
Mysql worked again on old machine!

Related

How to take backup of Mysql databases in XAMPP without using phpmyadmin

Here is my problem:
Because of some issues mysql not working in XAMPP 3.2.2 in windows 7. Then phpmyadmin in localhost shows Access Denied. So I want to reinstall the XAMPP. But, I'm unable to take backup of databases through phpmyadmin. Now how can I get the backup of databases. If I have the backup of data folder in xampp -> mysql then I'll copy the folder in new xampp folder then I'll get all my old databases with content or not. Is there any other way to get the backup of database?
Please help me to resolve my problem.
Short Answer: Yes, you will be able to recover.
Copy content from your /installation_path/xampp/mysql directory to your desired location.
ReInstall and copy back the content.
Restart your services.
[or]
If you have your backup in a Folder, do the following:
datadir = "your/path/mysql/backupdata"
in xampp/mysql/bin/my.ini

Export mysql datatabase from a dead hard drive - xampp

I have a dead hard drive. I've connected it with SATA to USB IDE and can recover files. Also the filesystems looks good. How Can I get a dump of database from that hard drive. The laptop I'm using also has mysql installed in it. I'm using xampp. I've tried the following command.
G:/xampp/mysql/bin/mysqldump -u root -p uma > D:/umaoldbackup.sql
This is not giving dump of a latest data. And I think it's giving dump from my local computer.
Please help.
Correct, mysqldump connects to the running MySQL Server process on your local computer, not the data on your sick hard drive.
MySQL client applications like mysqldump do not read the data files directly. They connect to a MySQL Server process and make requests for the data. Before you can access that data, you need to restore the data files to the data directory of an instance of MySQL Server.
Stop the MySQL service.
Copy data files to the data directory of your MySQL service. Move any existing data files to someplace else that is safe, if you want to bring back that data after exporting your umaoldbackup.
Start the MySQL service so it can read the files in that data directory.
You should probably get someone to do this for you if you don't know how to start and stop services on Windows.
Re your comment about where is the data directory...
I'm not a user of Windows or XAMPP.
It's probably actually C:\xampp\mysql\data according to What is the exact location of Mysql database tables in XAMPP folder?
But you can confirm that by connecting to your current MySQL service with a client and running the following query:
SELECT ##datadir;

Use XAMPP-phpmyadmin database of windows in Linux XAMPP

I was on windows and using XAMPP(installed somewhere else than C:/ )
Now i have moved on to LINUX and installed LAMPP.
So, i have this XAMPP folder from windows and i copied the project files from htdocs and now i need the database which i didn't exported while i was on windows.
I tried to copy the phpmyadmin folder from the old XAMPP folder but couldn't get it to work.
So how can i access the previous OS phpmyadmin to use my existing databases -
using linux (MINT - rosa-cinnamon)
Thanks in Advance !
If you want to move databases between hosts - especially when there are differences in the MySQL daemon version, operating systems (-versions) or storage schema - you should create a MySQL dump at host A and import it on host B: http://dev.mysql.com/doc/refman/5.7/en/mysqldump-sql-format.html
If this is no option for you anymore, you can try to move the old MySQL data directory (Configured in my.ini on windows, somewhere in the xampp directory) to the location where the new MySQL daemon stores its data files (Normally configured at /etc/mysql.my.cnf). A few more hints on this:
Ensure to modify the file permissions on the data files at the new location that the MySQL daemon can work with them.
On Windows, MySQL table names are case insensitive. On Linux they are case sensitive. Keep that in mind, if your application complains about missing tables.
And of course: Test this with backups only!

Migrating MySQL databases from files only

On a fresh install of MySQL on Mavericks (via Homebrew if that matters) how can I take database files from a back up and migrate them to /usr/local/var/mysql in the new instance? I have a directory for each database and one huge ibdata1 file.
If I move them by a simple file transfer, start the new instance and log in, each database is there however no data is present when I check a table.
it should work if keeping or upgrading server version. Make sure ownership and permissions are correct. Then run mysql_upgrade which will adjust the files.

How to recover Mysql database from backup files

I have using VPS that had to be re-imaged. my DB was part of it and it was being backup up as the app wasn't in production yet. However, there is some data that I wish to recover on it. the VPS provider is giving me a backup of the image (Ubunto Linux) that has all the files.
Is there a way I can recover my data?
The mysql data files in Ubuntu are located at /var/lib/mysql
To restore your database you need:
1) create new database named as old one
2) stop mysql server
3) copy old database files from /var/lib/mysql/your_database_name/ to new system
4) start mysql server
Your database will be restored.