I'm wondering if it's better to use mysql or use files to store data? What is safer, what is faster? I'm talking about php and mysql.
It completely depends on your requirements and setup.
For small amounts of data that doesn't require complex querying, files are faster. Site caches are one example.
For larger data sets or sets with more structure, a database will enable you to query your data in more advanced ways.
In terms of safety, files can be protected (using permissions) and stored outside the web root. Databases can be locked to certain hosts and can have users with different roles/permissions.