dump table contents into .log file

jeffschips

Well-Known Member
Jun 5, 2016
248
30
78
new york
cPanel Access Level
Root Administrator
Hello. I hope everyone is safe and healthy.

I need to dump the contents of a table in mysql to a .log file so that csf can analyze it and act accordingly but I'm getting the following error. Basically, I simply need to create a cronjob that periodically dumps one table from one database into a .log file.

I've tried without success:

mysqldump --tab=/tmp -u database_name --password='xxxxxxxxx' table_name output.log

mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
mysqldump: Got error: 1044: Access denied for user 'database_name'@'localhost' to database 'database_table' when selecting the database

I know I'm using the correct password for the user in the database.
 

andrew.n

Well-Known Member
Jun 9, 2020
875
325
63
EU
cPanel Access Level
Root Administrator
You need to use the root login details to dump the database or simply just skip user and password like:

mysqldump --tab=/tmp -u database_name table_name output.log
 

jeffschips

Well-Known Member
Jun 5, 2016
248
30
78
new york
cPanel Access Level
Root Administrator
Thanks @andrew.n

This is the error I'm seeing using the suggested method:

mysqldump --tab=/tmp -u database_name table_name output.log

mysqldump: Got error: 1045: Access denied for user 'database_name'@'localhost' (using password: YES) when trying to connect

Error 1045 I believe means I must provide a root password.
 

andrew.n

Well-Known Member
Jun 9, 2020
875
325
63
EU
cPanel Access Level
Root Administrator
Right, sorry. Could you give this a try?

mysqldump database_name table_name > dump.sql
 
  • Like
Reactions: cPRex

jeffschips

Well-Known Member
Jun 5, 2016
248
30
78
new york
cPanel Access Level
Root Administrator
thanks @andrew.n that works perfectly!

Now I need to extract only the part of the output that states:

'invalid login from xxx.xxx.xxx.xxx' where the x's are ip addresses.

All of this is to find those offending ip addresses attempting to brute force phplist since phplist has yet to come up to speed with two factor.

But thanks for the equation I know that parsing the output is not part of database issues so I can probably get that elsewhere.

You have a great day and stay safe!
 
  • Like
Reactions: andrew.n and cPRex