www.dflc.ch

Sysadmin and cooking recipes

MySQL – Convert several tables to utf8 encoding

| 0 comments

For those who, like need to convert all tables of a MySQL database (MariaDB should work too), please find below a very simple and efficient PHP script.

As I like to keep things simple and clear, and don’t want to install PHPmyAdmin or anything else on my database server.

Create a file named php convert_tables_utf8.php on your server then copy and the script content below

Adapt the variables to your environment and convert all database tables by running the script as below

If the script complain about missing PHP modules, make sure you’ve installed PHP MySQL extensions.
Checking the warnings and/or error in your terminal should give you more information.

Enjoy 🙂

Leave a Reply

Required fields are marked *.