In this paper, the quadratic p-median optimization problem is discussed, where the goal is to connect users to a selected group of facilities (emergency services, telecommunications servers, healthcare facilities) at the lowest possible cost. The problem is aimed at minimizing the cost of connecting these selected facilities. The costs are symmetric, meaning connecting two different points is the same in both directions. This problem extends the traditional p-median problem, a combinatorial problem used in various fields like facility location, network design, transportation, supply chain networks, emergency services, healthcare, and education planning. Surprisingly, the quadratic version has not been thoroughly considered in the literature. The paper highlights the formulation of two mixed-integer quadratic programming models to find optimal solutions to this problem. One model is a classic formulation, and the other is based on set cover theory. Linear versions and Bender’s decomposition formulations for each model are also derived. A Bender’s decomposition is solved using an algorithm that adds constraints during each iteration to improve the solution. Lazy constraints in the Gurobi solver’s branch and cut algorithm are dynamically added whenever a mixed-integer programming solution is found. Additionally, an efficient local search meta-heuristic is proposed that usually finds optimal solutions for tested instances. Challenging instances with up to 60 facilities and 2000 users are successfully solved. Our results show that Bender’s models with lazy constraints are the most effective for Euclidean and random test cases, achieving optimal solutions in less CPU time. The meta-heuristic also finds near-optimal solutions rapidly for these cases.