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.
Related
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.
I'm a beginner here and I can't seem to find the files. My professor wants me to send these files specifically to her, but when I "export data" from the workbench, it only generates .sql files. Where do I get the .myd, .myi and .frm files she's looking for.
Thank you
Don't worry about those. That's just how MySQL stores the data internally. If you read the documentation carefully you'll soon learn that you shouldn't depend on those files for backups anyway, they're likely to be in an inconsistent state if the server's running.
The best way to make a backup for small to medium-sized databases is the mysqldump command. There's a number of options that can be applied but the most important on a busy database is --single-transaction which produces a consistent point-in-time snapshot.
The SQL data you get from that, which can be saved to a .sql file, is sufficient to recreate the database and is a backup.
You can restore with the mysql command-line tool, or if you're not comfortable with that, the MySQL Workbench program.
Somewhere there is a data directory under a directory with MySQL in the filename, and under data is your own database directory. Files are in there. But if you haven't used MyISAM as the table format, the files will have different extensions, e.g. .idb for InnoDB.
You can find it via the query mentioned in #tadman's comment, or from a shell:
find / -name data -print
although you will probably get a number of matches.
You will have to stop the MySQL server before you can copy the files.
I'm having trouble with my Mysql and Apache server here for a week already. Tried to look for every possible solutions in the internet like changing ports and everything. Still no luck. I would like to reinstall Xampp, the problem is, I have important databases which do not have any backups yet. Is there a way to backup these databases without having my apache and mysql started?
It depends a bit on the type of storage engines you're using.
MyIsam
MyISAM tables are stored as files, so it is easy to do a backup by copying files (*.frm, *.MYD, and *.MYI files). In a typical XAMPP installation they can be found under c:/your/path/to/xampp/mysql/data/ .
InnoDB
Have a look at the manual:
Copy all InnoDB data files (ibdata files and .ibd files) into a safe place.
Copy all the .frm files for InnoDB tables to a safe place.
Copy all InnoDB log files (ib_logfile files) to a safe place.
Copy your my.cnf configuration file or files to a safe place.
However, if you have important databases, it is advised to think about a backup strategy before problems occur. MySQL offers a variety of backup strategies from which you can choose the methods that best suit the requirements for your installation.
Yes, you can just copy the data files. for innodb you need the ibdata1 (or similar) file. For MyISAM you will see 3 files (different extensions) for each database and the filename match the database names. If it is MyISAM then you can just copy these files back into the data directory on your new install and it will just work.
The other thing you should do is not use WAMP! It is easy enough to set up from scratch and much easier to figure out when things don't work.... you just need to read a little bit.
Copy all the files in your htdocs to another location first, duplicate the database organizers from information envelope and erase xampp then re-install it. You also need to delete the ib_logfile0, ib_logfile1 files from the data folder inside mysql folder.
Read here for further procedure https://dba.stackexchange.com/questions/3437/lost-tables-in-drupal-site-database
I have few hundreds of databases generated by different tools and archived in a central area. All the files are stored in zipped format. I tried importing those databases into mysql server by creating soft links in the var directory, but i dont see any tables in mysql. I can see all the tables if i unzip the files.
Is there a way to link the zipped databases?
No, you can't directly have mysql read databases from Zip archives.
If you are using Linux then you can install the fuse-zip filesystem (and Fuse if it's not already installed). This allows you to mount zip files as if they were filesystems. Point MySQL to your mount path and it will recognize the contents of the zip file(s) like any other file on your system.
http://code.google.com/p/fuse-zip/
It should go without saying that there will be a performance penalty but considering these are archived databases I'm guessing that's not an issue.
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.