Uninstall MySQL Server on Mac OS

When I upgraded from Mac OS X 10.12 (Sierra) to 10.13 (High Sierra) suddenly my MySQL Server just broke down and it was unrepairable, so I’m going to try to install it with brew, but in order to do that I needed to uninstall the current one and this is a clean way to do it

Just run the following commands

sudo rm -rf /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
sudo rm /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

I had a problem with a configuration file, so it’s better to remove it

sudo rm /etc/my.cnf

Fix Malformed UTF-8 characters, possibly incorrectly encoded error on Eloquent

This is one of those errors that are pretty much undocumented and can lead to a huge waste of time trying to figure it out why, so I’m going to tell you how I fix it and hope that helps you too.

I was trying to add binary data into the database using the save() method on the Model and it keep failing time after time saying:

InvalidArgumentException: Malformed UTF-8 characters, possibly incorrectly encoded in ../vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php

To fix this on Laravel you just need to make sure that you are inserting correctly the information, after a while I realize that I was inserting some truncated data on the table and the exception thrown by Eloquent was catched by the exception handler, and it contained some binary data that was being responded afterwards.

So this is just an error generated because the system was trying to report another previous error, now after the stress it’s gone, it’s kind of funny.