Permisson Denied

Hi I’m trying to install erpnext using the manual located at Guide: Manual Install ERPNext on Ubuntu 17.xx & 18.xx .
While executing the command

sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu xenial main'
````Preformatted text`
I get an error `Preformatted text`sudo: unable to execute /usr/bin/add-apt-repository: Permission denied


Even If i proceed further , 
I get these errors : 


While editing a configuration file 

sudo nano /etc/mysql/my.cnf


I'm not able to edit the file , because the system never accept the changes . 


Finally , 
When I pass these commands  : 

sudo systemctl restart mariadb
sudo systemctl enable mariadb

I get the  an error :-

No D-B Connection , service manager