PHP/MySQL question?

So I'm working on building a drupal-based site at the moment. Last Friday, I took home the file structure and database so I could tinker with it.

Well, the database was like 18 megs, so I imported it to the server on my laptop using this--
source /etc/drive/foo/whatev.sql;

It imported with all sorts of garbage characters like ligatures and random accented vowels interspersed with the normal text.

However, when I opened up php.ini and changed the max_download variable so I could import it in phpmyadmin, it worked fine. So...

A: Can I replicate whatever phpmyadmin is doing at the command line without having an insanely huge file upload limit?

B: Why is this nonsense happening in the first place?

2008-06-30T09:12:56Z

Collin: How is that different from using the source command I mentioned?

Gr1m: A.18 megs is not a massive amount of data. It's not even worth looking at the checksum.

B. I'm not streaming anything. This is the webserver on my laptop, as mentioned.

C. I don't think you know what you're talking about.

2008-06-30T14:17:38Z

Using the command line so I can use the 'source' command.

The size of a database imported using phpmyadmin is constrained by post_max_size and upload_max_filesize in php.ini.

Every time I've refreshed this site on my laptop, I've exported the database as a whole from my work machine, dropped the original on the laptop, and reimported it as a whole.

Collin H2008-06-30T09:05:46Z

Favorite Answer

The source command runs a MySQL script file, not a database backup. When MySQL dumps the database it does so with a bunch of SQL commands, rather than a script. You should be able to do what phpMyAdmin is doing by simply using:

C: > mysql < filename.sql

bustin982008-06-30T10:03:57Z

It would seem we're not getting all of the pertient information. Like, why are you using that command to import the sql?

You have two options to import a sql file, as outlined here:

http://www.ehow.com/how_2036644_import-sql-database.html

So, whats up with the unreadable characters? Its probably a cross of how the database is setup and the method you used to import it. That is going by what you have mentioned.

I also find it odd that you had to increase the file size in the php.ini to a very large number before the sql file could be read into phpmyadmin, though my situation requires a large number anyway so I don't have the experience any other way.

When you exported the database, did you export the structure as a seperate file from the content, or is all in one file?

Gr1m2008-06-30T09:02:00Z

A: Have you tried uploading it to the server separately from importing it to MySQL? e.g. Upload the file to the server and import the file from the server into MySQL.

B: You're streaming a massive amount of data, bound to catch garbage in the transaction, that was the initial purpose of things such as zipping files.