mysqldump not restoring data in MySql 5.0.19 - mysql

I have a production and a development server, each server has its own MySql server. I am not the admin of any server, not installed anything. I need to get the schema and data from the production to the development but myslqdump does not restore any data!
I tried to add SET FOREIGN_KEY_CHECKS = 0; without result. Then I removed the only trigger present, nothing. Then I removed two foreign keys that created and error (when importing phpMyAdmin). Then I was able to import the data.
This is quite scaring. I cannot rely on mysqldump, isn't? Did you have similar problems? Any advise?

are you dumping and restoring with phpmyadmin? what error do you get?
for large mysql databases i recommend to user mysqldumper for dumping and restoring if you have no ssh access.
http://www.mysqldumper.net/

Related

Can't export MySQL database with PHPMyAdmin

I have a MySQL 5.5 database in a web hosting, which I access using PHPMyAdmin (the hosting provider doesn't give me shell access). I back the database up using the "Export" function in PHPMyAdmin.
Recently, however, whenever I try to run the backup, I get an interrupted DB dump, and I see in it a PHPMyAdmin backtrace saying that "MySQL: the server has gone away". The two solutions to this, as I understand it, are:
Changing the "max_allowed_packet" parameter in the server... but I can't do that.
Repair tables... but I checked the status of the tables in the DB, including the ones where the dump usually stops, and they all seem OK.
I can always back it up in chunks, but it's a hassle to do that when the DB has about 40 tables. What can I do to fix this?

MySQL restoring database functions using frm, myd and myi files

MySQL had an error updating and caused my database to stop working correctly. I had to reinstall mysql during this process I was looking up how to restore my database after reinstalling. I was able to restore the database with all the tables and data inside them using the instructions in the following post:
Restoring database from physical files
But I noticed the functions weren't restored with the rest of the database. Anyhow I was wondering if someone could give me a hand with this?
I am running mysql on an nginx server. All help is appreciated. Thanks!
The stored functions and stored procedures for all databases are stored in the proc table inside the mysql schema.
You'd need to restore the proc.FRM, proc.MYD, etc. files, inside the mysql directory, preferrably with the server stopped, since your reinstalled server already has those -- presumably empty.

Will a MySQL database without InnoDB work when imported to typical Ubuntu localhost?

I have this situation. The site that I'm working with has MySQL configured without InnoDB. My Ubuntu localhost has MySQL server running with InnoDB.
Question: If I export the MySQL database of the remote site and import it to my local Ubuntu MySQL , will that work without any issues? Supposing I export it using the mysql command line mysqldump and restore it via command line too. The database is a bit large so I need to check first whether this will work.
I'm planning to import it locally so I can test the site for the functionalities needed. Please let me know if this plan will work. Thanks :)
First if mysqldump have engine=InnoDB statement in CREATE TABLE block, Then it could possible to import failure if Local MySQL is not configured to use InnoDB (I personally think InnoDB is always available, However it could be non default engine).
After successful import, It may be automatically converted to default MyISAM Engine. So All foreign keys and InnoDB related objects will not imported in this case. Now if your application very much depend on DB based Foreign keys mechanism, Then it can broke. Otherwise things should work like before.
Personally I imported InnoDB databases before end they automatically converted to MyISAM. Application work seemlessly as That manage constraints on Application side (in MVC Models).

How to use Incremental Backup

I have a mysql database at a remote server that gets updated once in a while and what i normally do to transfer it to my locale machine is to
mysql -u root -padmin databasename > backup.sql
Then on the workbench of my local machine i just delete the old database and import this new database.
I usually did this because updates came in once a month. So i wasn't bothered. But now the data has gotten pretty big and i can't afford to do this anymore. I just thought there is a better approach so i looked into incremental backups but i don't quite get it. In my situation, how will i use incremental backups ? So that in the remote server i only backup the latest changes in the remote database then import to my local database ?
As long as you are using InnoDB, the percona guys can help you with xtrabackup: http://www.percona.com/software/percona-xtrabackup
It has incremental options and also restores quickly. I'm not sure it supports myisam (since that engine is not ACID).
We use it at work to great effect.

How can I recover MySQL tables from data files?

I've got a database (all MyISAM tables) and the machine where MySQL was running is no longer bootable. However, we have all the MySQL data files from the data directory. How can I restore the data from the MYD and FRM files, or whatever other files I should be looking at in the data directory?
I've been doing some searching on this and it sounds like for MyISAM I should just be able to copy the database subdirectory from the old MySQL data directory to the new MySQL data directory. However, that's not working for me. A database with the name of the database I'm trying to recover shows up in the list of databases in phpMyAdmin, but all the tables show "in use" and have no information (e.g., number of rows, number of bytes, column information, etc.). Any operation on those tables (e.g., SELECT * FROM {table}, REPAIR {table}, CHECK {table}) returns a "no such table" error.
One of the tools I ran across in my search is DBACentral by MicroOLAP. It's got component that's supposed to restore data from FRM/MYD files, but when I tried to run it, it didn't list any tables that it could recover from my FRM/MYD files.
This is on a developer workstation that's running Vista Business 32bit. MySQL version is 5.0.27. After fixing the machine, I went and got the exact same version of MySQL (v5.0.27), thinking that if I'm just going to drop in the binary data files I should do it with the same version of MySQL. It still didn't work.
Any insights would be greatly appreciated... thanks!
-Josh
Install the same version of mysql.
Remove mysql directory from data directory of the server and copy it from the crashed server. This is the key element
copy directory of database you want to recover into data directory of new server
start mysql.
switch to mysql database: USE mysql; and run REPAIR TABLE <table name> on every table.
Do the same with database you want to recover
tip: make sure the 2 directories have the same permissions like data directory
If you did not save mysql database (mysql directory in your old server's data dir, then you can try to:
create database with the same name as database you want to recover.
Then you can create each table (it would be good to use the same structure - you'd have bigger chance of recovery).
then stop mysql server and delete files from database directory and overwrite them with files from old server
start mysql and repair each table.
I wound up giving up. I think the answer is that, with my particular version of MySQL, this doesn't work. Hopefully things have improved since then.