Demystify integration of \int \frac{1}{x} \mathrm dx\int \frac{1}{x} \mathrm dx

I’ve learned in my analysis class, that

I can live with that, and it’s what I use when solving equations like that.
But how can I solve this, without knowing that beforehand.

Assuming the standard rule for integration is

If I use that and apply this to $\int \frac{1}{x} \,\mathrm dx$:

Obviously, this doesn’t work, as I get a division by $0$. I don’t really see, how I can end up with $\ln(x)$. There seems to be something very fundamental that I’m missing.

I study computer sciences, so, we usually omit things like in-depth math theory like that. We just learned that $\int \frac{1}{x} dx = \ln(x)$ and that’s what we use.

If you want to try to prove $\int\frac{\mathrm dx}x=\ln x + C$ (for $x \gt 0$), try the substitution
This substitution is justified because the exponential function is bijective from $\mathbb{R}$ to $(0,\infty)$ (hence for every $x$ there exists a $u$) and continuously differentiable (which allows an integration by substitution).
Now just use the fact that natural log is the inverse of the exponential function. If $x=e^u,u=\ln x$.