# CronJob Error

**URL:** <https://forum.mautic.org/t/cronjob-error/2481>\
**Category:** Product Support\
**Created:** [October 6, 2015, 6:37pm UTC](https://forum.mautic.org/t/cronjob-error/2481 "2015-10-06T18:37:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sellout](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@sellout](https://forum.mautic.org/u/sellout)\
**Post date:** [October 6, 2015, 6:37pm UTC](https://forum.mautic.org/t/cronjob-error/2481/1 "2015-10-06T18:37:29Z")

</div>

I’m setting up Mautic on a local environment for testing using Mac OSX.  
  
  
  
When I use terminal to manually fire: the cronjobs listed here:[https://www.mautic.org/docs/setup/index.html](https://www.mautic.org/docs/setup/index.html)  
  
  
  
I end up getting a sql error:

Code:

 [PDOException] SQLSTATE[HY000] [2002] No such file or directory 

mautic:leadlists:update [-b|–batch-limit[="…"]] [-m|–max-leads[="…"]] [-i|–list-id[="…"]] [-f|–force]

  
Because I get the "mastic:leadlists:update...." it tells me my path is correct. Any ideas on how I can resolve this before listing in CronTab?

---

<div class="post-metadata">

**Author:** ![sellout](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@sellout](https://forum.mautic.org/u/sellout)\
**Post date:** [October 6, 2015, 6:37pm UTC](https://forum.mautic.org/t/cronjob-error/2481/2 "2015-10-06T18:37:29Z")

</div>

I’m setting up Mautic on a local environment for testing using Mac OSX.

When I use terminal to manually fire: the cronjobs listed here:[https://www.mautic.org/docs/setup/index.html](https://www.mautic.org/docs/setup/index.html)

I end up getting a sql error:

```auto

  [PDOException]                                    
  SQLSTATE[HY000] [2002] No such file or directory  
                                                    
mautic:leadlists:update [-b|--batch-limit[="..."]] [-m|--max-leads[="..."]] [-i|--list-id[="..."]] [-f|--force]

```

Because I get the “mastic:leadlists:update…” it tells me my path is correct. Any ideas on how I can resolve this before listing in CronTab?

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 7, 2015, 7:09am UTC](https://forum.mautic.org/t/cronjob-error/2481/3 "2015-10-07T07:09:05Z")

</div>

How does your command look like?

---

<div class="post-metadata">

**Author:** ![sellout](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@sellout](https://forum.mautic.org/u/sellout)\
**Post date:** [October 7, 2015, 4:20pm UTC](https://forum.mautic.org/t/cronjob-error/2481/4 "2015-10-07T16:20:01Z")

</div>

Hey,

I managed to figure this out.

In the config.php, Mautic was trying to connect to mysql using the the host: localhost. By updating to 127.0.0.1 and clearing the cache, this problem was solved.

---

<div class="post-metadata">

**Author:** ![carlos](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@carlos](https://forum.mautic.org/u/carlos)\
**Post date:** [October 14, 2017, 2:17pm UTC](https://forum.mautic.org/t/cronjob-error/2481/5 "2017-10-14T14:17:28Z")

</div>

In case someone else finds this and the current answer did not fix the problem: Another possible issue might be your path to PHP, so make sure you use the full path to php, for example:

```auto
/usr/bin/php <full_path_to_mautic>/app/console <mautic_command>
```

FYI: I had this issue while testing on localhost

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [February 2, 2020, 10:58pm UTC](https://forum.mautic.org/t/cronjob-error/2481/6 "2020-02-02T22:58:00Z")

</div>


