Check out example codes for "can't create table errno: 13 permission denied mysql". It will help you in understanding the concepts better.

Code Example 1

#1-fix permission
$ mysql -uroot -p -e 'SHOW VARIABLES WHERE Variable_Name="datadir"'

#output
+---------------+-----------------------+
| Variable_name | Value                 |
+---------------+-----------------------+
| datadir       | /var/lib/mysql/ |
+---------------+-----------------------+
 
#2- Check owner of each file
$ ls -lh /var/lib/mysql/
 
#3- Update to correct owner
$ sudo chown -R db_admin:server_name /var/lib/mysql/*

Learn ReactJs, React Native from akashmittal.com