mysql-ctl cli
GRANT ALL PRIVILEGES ON *.* TO <username>@localhost;
SHOW VARIABLES LIKE 'socket';
quit;
mysqldump -u<username> --protocol=tcp -S /home/ubuntu/lib/mysql/socket/mysql.sock --all-databases > db.sql
There were two tricks. Firstly, mysqldump did not allow me to run it as a regular root user, so I created my own username with full privileges. Then I looked at which outlet he ran into. Then I indicated that it should work with tcp protocol. This exported all my sql tables.