Export table from Xampp MySQL from file directory - mysql

I have an error with Xampp where it will not connect to my database. I have had this error several times in the past and no solutions have helped. I find that uninstalling and reinstalling ends up being the fastest method, however, by doing so I lose my database tables. As I have no access to the default export and import functions, I was wondering how I transfer the tables across.
Last time, I copied and pasted these files into the same directory when I reinstalled Xampp and the tables transferred but the data within did not. The tables had also lost some functionality as well.
If anyone has any methods to do this I will greatly appreciate it.

The best way to backup and restore your data is to dump the database to an SQL file. You can use the provided mysqldump tool for that, which is the best tool for the job.
Copying the entire MySQL "datadir" (which is probably one level up from the screenshot you've posted) and completely replacing one of your new stopped MySQL instance will probably work, but is not reliable and is not supported. Since there are other files (such as ibdata1) that handle the overall health and functioning of the entire MySQL instance, you can't only copy over individual database directories. Furthermore, you should only do this when the original and replacement MySQL servers/daemons/services are completely stopped because otherwise there are file corruption or concurrency issues.
Since you're running the server on your own computer, you should grant yourself sufficient access to be able to use mysqldump and use that regularly as a backup, since file-level backups of the data directory are not reliable.

Related

Transfer MySQL files directory from directory

What do I have to do to these files so that I can copy and paste the files into another program using only default windows functions? Copying and pasting it directly leads to an unstable database and the data within each table does not transfer.
As we answered in your other (nearly identical) question Export table from Xampp MySQL from file directory, this is not recommended and can lead to inconsistency. I could repeat here what I said there, but the answer is the same: if the MySQL service is stopped and if the entire datadir is copied and replaced, and if the MySQL versions are similar enough, then you might be able to accomplish this...but it's not supported and not recommended and you're much more likely to lose data than have success. File-level backups are not recommended for MySQL databases, you should export to an SQL file.

Only was able to recover MySQL data folder (IBD, FRM, and OPT files), can I recover databases?

As title says, I had an unfortunate failure which resulted in me only being able to recover my MySQL data folder (IBD, FRM, and OPT files). I built a new server and installed MySQL 5.6 (old one used 5.5). I copied over the data folder hoping I would get lucky, and I do see my old schemas in MySQL workbench, but when trying to look at any table in them I get an error like this:
https://www.dropbox.com/s/q2eui8eyu621f3c/sqlerror.jpg?dl=0
I don't remember seeing any .data files on the recovered data and am wondering if it's possible for me to recover my old tables. I'm not sure whether or not the old or new is InnoDB or myisam and am not exactly sure how to tell.
Any tips appreciated.
In case someone else who doesn't know how to restore their databases runs into a similar issue, I was able to recover my data. Instead of copying and pasting everything in which did not work, I stopped the MySQL service, pasted all the database folders in, and only the "ibdata1" file. Then I restarted the service and loaded up workbench and all my data as restored in 5.6.

Move native phpmyadmin databases to xampp

After a computer crash (Mac OSX Update), I was able to recover my files from a back up. In order to make things easier on me in the future, I decided to move to XAMPP instead of using the native PHPMyAdmin and MySQL. I know where PHPMyAdmin was pointing before - how do I move the files so XAMPP can see them?
It's not a recommended means of backing up and restoring, but as long as there's nothing in the XAMPP databases you might just be able to replace the XAMPP data directory with the backup from your old MySQL one. Note that XAMPP may have "important stuff" in the database by default; I don't use it so I have no idea. You can also just drop in specific databases (which are represented on disk by files or folders of similar name), but will have to recreate permissions and users for those.
It's better to do SQL exports and imports for backing up your data.

mysql - how do I load data from a different configuration

I'm not sure if this will make sense, but I'll give it a shot.
My hard drive went down and I had to reinstall the os along with all my webserver configuration,etc. I kept a backup of the mysql database, but it doesn't contain all the tables...I added a couple tables after my last backup.
I have access to the hard drive and the directory where the mysql data files are stored from the failed hard drive, but I don't know how to retrieve the data into my new mysql database. Is it even possible to get the raw data files from mysql and load them into a different instance? I'd even be happy if there was some way for phpmyadmin to show the data files, then I could dump out to a backup txt file, and reload them into my new configuration.
Any help will be appreciated. thanks.
well, bad news...I can't access the drive anymore. As I tried to copy the files the drive went totally down. So, I'll just redo the couple tables. Thanks for your help anyway.
Although not recommended or reliable, it is possible to simply copy the data without using mysqldump. It might help if MySQL was shut down in a controlled manner (which does not appear to be the case) and the source and target environments are as similar as possible in terms of lib and MySQL versions.
The datafiles should be compatible - you can copy the data directory to ubuntu, and edit the /etc/mysql/my.cnf to point to the new directory.
The only catch might be where ubuntu being case sensitive effects the tables.

Re-installing MYSQL(windows) - How to get to the old data with the new install?

I needed to re-install my computer but I didn't think about exporting the data from mysql 5.
How do I get the data from the old installation into the new installation, is this just copying the data directory or do I have to take other steps to get to the data?
For MyISAM tables you can generally get away with copying them across. (Whilst the server's stopped, obviously.) For InnoDB, it can work, but you'll have to have the same basic block size settings. If you can use the same major version of MySQL and the same my.cnf you stand a good chance of having it work.
Afterwards it's a good idea to ensure the tables are rebuilt (eg. using ALTER TABLE), and make a note to mysqldump properly next time because none of this is supported or guaranteed to work!
I would export your data as a sql file from mysql (ie: with phpmyadmin) and then import it into the new installation. Your db should be built and filled with data pretty easily.
You said that you "didn't think about exporting the data". Does that mean you don't have access to the old installation any more?