1

Using phpMyAdmin, I was getting an error when importing a MySQL dump file to which I'd made a simple global find-and-replace:

Error
SQL query:

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
MySQL said:

#1231 - Variable 'character_set_client' can't be set to the value of 'NULL'

The strange thing is I had just exported the dump, and this is all I did.

So then I tried exporting a .zip again, and re-importing without making any changes. And I got the same error.

I was able to import the file, finally, by deleting these lines from the dump:

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

But I'd like the export/import process to just work.

So my question is: How can I prevent this from happening with future imports, in a way that doesn't require looking up this issue again?

Note: I'm on a shared server setup; I don't currently have SSH access.

0

Not a user of phpMyAdmin, but mysqldump has an option to disable those lines from the dump:

Unfortunately, this will work if you have access to mysqldump. Not sure if phpMyAdmin has configurable options for export, but hope this helps.

  • Thanks for the answer. Unfortunately I only have access to phpmyadmin. The export function only shows one setting related to charset — setting the charset of the file itself. Which I've set to utf-8 (it's a dropdown setting) – Jeremy Carlson Oct 27 '16 at 18:08
0

It sounds as if my.cnf or some other setting, perhaps via phpmyadmin, has set some of those variables to NULL before executing that script. Rummage around; if you find it, change it.

Alternatively, you can edit the dump file to remove the offending lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.