Solved: MySQL convert_tz returns null on MacOS Catalina using XAMPP
Note: A little bit of a story since I haven’t been writing for a while. If you are in a hurry for the solution, scroll down to The Solution
After a while, I am trying to write another blog. This time without using a keyboard. I am trying out voice to text feature on my new MacBook Pro 2019 model. I had to change my MacBook Pro retainer model due to random slow which turned out to be a problem with the logic board as per Apple genius.
Instead of using Time-Machine to restore files from old Mac, I did the manual copy-paste as the old mac was really slow and I was confident that I had time machine backup from the previous day. So I opened the time machine disc and copied over the files that I needed. But that came with a problem. I had to install fresh XAMPP and the timezone table was not loaded by default. One of the projects that I work with was using it and had to get it working.
While the discussion for the same issue is everywhere in MySQL forum and StackOverflow, nothing was working for me due to tightened security of Catalina and XAMPP’s way of running MySQL on Mac ( I am not using the virtual machine way of running XAMPP, but the regular old school way )
- Steps to the solution
- Open Terminal ( I use iTerm ).
- $ cd /Applications/XAMPP/xamppfiles/bin
- $ ./mysql_tzinfo_to_sql /usr/share/zoneinfo | sed -e “s/Local time zone must be set–see zic manual page/local/” | ./mysql -u root mysql