0
votes

I wish to copy the /var/lib/mysql folder to a different folder in a job as jenkins, via this shell command:

cp -R /var/lib/mysql ~/Container/feature

But it gives permission denied when the job runs.
I have set jenkins user to mysql group.

In addition I gave /var/lib/mysql and sub-directories rwx-r-x-r-x, but whenever a new table is created by Mysql, it only has rwx-r-x--- permisssion, so that next time that specific table is not copied. It's giving a Permission Denied error.

Is there any way to solve this problem ?

1

1 Answers

1
votes

So, you are trying to copy the DB by copying raw filesystem files? That's really not good for the DB, nor a supported way.

mysqldump -A > alldump.sql
That will get you a supported mysql dump of all databases/tables.

You can then load it on remote database with mysql < alldump.sql