For the linear model with a single regressor $y= \beta x + u$ it is not the case in general that $\hat \beta = \frac{\hat cov(X,Y)}{\hat \sigma_x^2}$, exactly because it is not clear whether $y$ and $x$ have mean zero. What is true is that
$$\hat \beta = \frac {\sum_{i=1}^ny_ix_i}{\sum_{i=1}^nx_i^2}$$
If we know that $y$ and $x$ have zero means (i.e. theoretical expected values, and irrespective of what happens in the sample means), then the above is the ratio of estimated covariance over variance (after multiply and divide by $(1/n)$ of course).
Assume now that we have a regression with multiple regressors including a constant term, $a$. Then partitioned regression results tell us that, in reality the $\beta$-vector containing the coefficients of the regressors (except the constant term) is estimated using the variables centered on sample means, i.e. in
$$y = a + \mathbf x'\beta + u$$
applied to a sample of size $n$, the OLS estimator for $\beta$ is
$$\hat \beta = (n^{-1}\mathbf {\tilde X'} \mathbf {\tilde X})^{-1} n^{-1}\mathbf {\tilde X}'\mathbf {\tilde y}$$
with $\mathbf {\tilde X} = \mathbf {X}-\mathbf {\bar X}$ and $\mathbf {\tilde y} = \mathbf {y}-\mathbf {\bar y}$ where the bar denotes sample means. Then $n^{-1} \mathbf {\tilde X}'\mathbf {\tilde y}$ is the vector containing the sample covariance between each regressor and the dependent variable, and $n^{-1}\mathbf {\tilde X'} \mathbf {\tilde X}$ is the sample variance-covariance matrix of the regressors (without including the contant term).
If we want to write $\beta$ to include the constant term (as is often the habit), then this relation is not immediately obvious (but it still holds).