All we running through situations where data needs to move from one server to another or we need to start access MySQL from an external machine rather than “LOCALHOST”.
Before doing this, make sure you really need it , allowing access database to externally is a serious breach of security, still you need, let us go through steps.
You must have root access to database machine to make changes. As you are going edit “my.cnf” file. First task to find correct file. at Ubuntu it is usually /etc/mysql/my.cnf or in newer version , it may be at /etc/mysql/mysql.conf.d/mysqld.cnf.