In this article, we prove that the following weighted Hardy inequality $$\begin{array}{ll}\big(\frac{|{d-p}|}{p}\big)^{p}\, \int\limits_{\Omega}\, \frac{|{u}|^{p}}{|{x}|^{p}}\;d\mu \\ \quad \quad \le \int\limits_{\Omega}\,|{\nabla u}|^{p}\;d\mu+ \big(\frac{|{d-p}|}{p}\big)^{p-1}\,\textrm{sgn}(d-p)\,\int\limits_{\Omega}|{u}|^{p}\,\frac{(x^{t}Ax)^{p/2}}{|{x}|^{p}}\; d\mu \quad \quad \quad (1) \end{array}$$ holds with optimal Hardy constant $${\big(\frac{|d-p|}{p}\big)^{p}}$$ for all $${u \in W^{1,p}_{\mu,0}(\Omega)}$$ if the dimension d ≥ 2, 1 < p < d, and for all $${u \in W^{1,p}_{\mu,0}(\Omega{\setminus}\{0\})}$$ if p > d ≥ 1. Here we assume that Ω is an open subset of $${\mathbb{R}^{d}}$$ with $${0 \in \Omega}$$ , A is a real d × d-symmetric positive definite matrix, c > 0, and $$ d \mu: = \rho(x) \,dx \qquad \textrm{with} \quad \rho(x) = c \cdot \exp(-\frac{1}{p}(x^{t}Ax)^{p/2}), \quad x \in\Omega.\quad \quad (2) $$ If p > d ≥ 1, then we can deduce from (1) a weighted Poincare inequality on $${W^{1,p}_{\mu,0}(\Omega \setminus\{0\})}$$ . Due to the optimality of the Hardy constant in (1), we can establish the nonexistence (locally in time) of positive weak solutions of a p-Kolmogorov parabolic equation perturbed by a singular potential in dimension d = 1, for 1 < p < + ∞, and when Ω = ]0, + ∞[.