convert an InnoDB database to MyIsam

The problem of Innodb is that you can’t copy the database tables from a PC to another or from localhost to an online website, because of the file “ibdata1”, which is out of the tables folder.

So I think that the best solution, if you need to sync your database between different locations, is to convert Innodb tables into MyIsam tables, which can be copied without problems.

Unfortunately I didn’t find a way to convert a whole database with a single mysql command, but I had to convert each table, with this code:


But at the end the result was any way good.

mysql change column encoding

You can use this syntax (to change encoding a TEXT column to utf8):
ALTER TABLE name-of-the-table MODIFY name-of-the-column type-of-column CHARACTER SET utf8 COLLATE utf8_unicode_ci

But it’s also possible use PhpMyAdmin to change grafically the ecoding.

calculate age from year of birth

There are two ways:

via php

## 2. in php
You can also use php code, as in the following way
(inspired from this page (, and _slighty modified_: 

    $dob =”$row[anno_nascita]”;
    $age = date_diff(date_create($dob), date_create(‘now’))->y;
    echo “age: $age years

via mysql in phpmyadmin this sql query:
     select *,year(CURDATE())-year(anno_nascita) age from studenti__classi; 
2. save the result as view
3. and so you will have, in the view, the age (of your students, i.g.) that can work in LibreBase (to connect with that view).