what is the best approach for messaging system with mysql?
My advice to you would be to download a few (3 - 5 of the most popular) apps which perform similar functionality to what you want to achieve.

Then, I would adopt and adapt [some | a few | various] ideas from these to obtain what you want - or as close as you can reasonably come with reasonable effort. Particularly, check out their schemas - no matter what the database.

Just a word about database selection - if you haven't started this project yet, then permit me to recommend PostgreSQL instead of MySQL. It has windowing (analytic) functions, CTEs (Common Table Expressions - AKA WITH clauses), proper SET operators and CHECK constraints. This is just IMHO, but it is my firm belief that having this functionality integral to the database will save you a lot of time, grief and debugging from having to write all this functionality into your app yourself - or having to choose restricted functionality.