Error with SQL:
  select
    a.ad_id,
    a.mileage,
    a.make_id,
    a.model_id,
    a.reg_year,
    a.price,
    a.description,
    date_format(a.expiry_date, '%Y%m%d%H%i%s') as expiry_date_fmt,
    date_format(a.creation_date, '%Y%m%d%H%i%s') as creation_date_fmt,
    if(a.expiry_date < sysdate(),1,0) as expired_p,
    date_format(a.last_updated_date, '%d/%m/%Y') as last_updated_date,
    a.main_image_id,
    e.engine_size_text,
    l.location,
    mk.make,
    md.model,
    fu.fuel_type,
    cl.colour,
    a.colour_description,
    bd.body_type,
    a.variant,
    a.owners,
    tr.transmission_type,
    a.reg_number,
    a.nct_due_month,
    a.nct_due_year
  from
    car_ads a
  inner join car_models md on a.model_id = md.model_id
  inner join car_makes mk on a.make_id = mk.make_id
  inner join locations l on a.location_id = l.location_id
  left join car_engines e on a.engine_id = e.engine_id
  left join car_fuel_types fu on a.fuel_type_id = fu.fuel_type_id
  left join car_colours cl on a.colour_id = cl.colour_id
  left join car_body_types bd on a.body_type_id = bd.body_type_id
  left join car_transmission_types tr on a.transmission_type_id = tr.transmission_type_id
  where a.ad_id = 2365336
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)