So the more general idea comes from variational calculus; it is that we have a Lagrangian mapping a configuration space $L(\vec c):\mathcal C \to \mathbb R$ and we have a path through configuration space $\vec P(s): [0,1]\to\mathcal C$ and the action is the integral of their composition $S = \int_0^1ds~L(\vec P(s)).$ The idea is that we introduce a small path-perturbation that vanishes at the endpoints: $\epsilon~\vec p(s)$ such that $\vec p(0) = \vec p(1) = 0.$
The resulting change in the action is $$\delta S = \int_0^1 ds~\left(L(\vec P + \epsilon \vec p) - L(\vec P)\right),$$and the goal is to search for the paths through configuration space $\vec P$ such that to first order the action is stationary against such path-perturbations; i.e. $\lim_{\epsilon\to 0}\delta S / \epsilon = 0.$ We physicists are stealing the mathematics used to solve this equation.
How we get the Euler-Lagrange equations from this
You may see, in our sloppy physics, that $L$ is written something like $$L = \frac12 m \frac{d\vec r}{dt}\cdot \frac{d\vec r}{dt} - U(\vec r).$$
The above formalism has no space for this sloppiness: $L$ does not have any notion of the path; it cannot take time-derivatives. Instead we need to make the configuration space $\mathcal C$ six-dimensional, having three independent dimensions of velocity, independent of the three independent dimensions of position that we already have. That is, the proper expression is $L= \frac12 m \vec v \cdot \vec v - U(\vec r)$ with no notion, at the Lagrangian level, of the connection between $\vec v$ and $\vec r.$ We then insert this dependence explicitly into the form of $\vec P$ and $\vec p$ that we are considering. For this it is useful to write $\epsilon~\vec p$ as $\delta \vec r$ for a moment so that we can expand this to first order in $\epsilon$ as:
$$\delta S = \int_{t_0}^{t_1} dt~\sum_i\left(\frac{\partial L}{\partial r_i} ~\delta r_i + \frac{\partial L}{\partial v_i} \frac{d}{dt}\delta r_i\right),$$and then the condition that $\delta\vec r(t_1) = \delta\vec r(t_0) = \vec 0$ is crucial because it allows us to integrate the latter term by parts, to find
$$\delta S = \int_{t_0}^{t_1} dt~\sum_i\delta r_i \left(\frac{\partial L}{\partial r_i} - \frac{d}{dt} \frac{\partial L}{\partial v_i}\right).$$Notice the very strange meaning of this expression, it is entirely important: $L$ is just a plain function, we take a partial derivative with respect to one of its independent variables $v_i$: then we evaluate this partial derivative function on the points of the path $(\vec r(t),~ d\vec r/dt),$ then we take the time derivative of that mess. But since $\delta r_i$ can be arbitrary each of these equations must vanish independently for $\delta S$ and we must have the Euler-Lagrange equations,$$\frac{\partial L}{\partial r_i} - \frac d{dt} \frac{\partial L}{\partial v_i} = 0,$$on the acceptable points of the path. Again, it is very important in order to interpret this expression that the partial derivative with respect to $v_i$ is taken with no indication that the position and velocity are related, then the actual velocity $\dot r_i$ is substituted in for it, and finally the time derivative applies to both alike. Therefore with an expression $\frac 12 m \vec v\cdot \vec v$ one usually gets $-m\ddot r_i$ from this term, with no contribution from $U(\vec r)$ which vanished when we took the partial derivative.
How it's more complicated than that
So we have seen that handling first-derivatives in time in our expression causes an enlargement of the configuration space which is resolved outside the Lagrangian. But second-derivatives must also have the exact same principle going for them, we now need to make our Lagrangian depend on $(r_1, r_2, \dots r_n,~v_1, v_2,\dots v_n, a_1, a_2, \dots a_n).$ When we do out the Euler-Lagrange equations we will therefore find a new term, resulting from double integration by parts,
$$ \frac{\partial L}{\partial r_i} - \frac d{dt} \frac{\partial L}{\partial v_i} + \frac {d^2}{dt^2} \frac{\partial L}{\partial a_i}= 0.$$
This does not usually happen with time derivatives in physics, but here is an instance where it comes about from space derivatives: consider the deformation of a beam along the $x$-axis in the $y$-direction, forming some shape $y(x)$. There is some mass-per-unit-length $\lambda(x)$ and we therefore expect that the action is a sum over each little mass element. But what is our potential energy here? Our potential energy must not depend on $y(x)$ or even $y'(x)$ as it's okay for the beam to lay flat at an angle: its internal energy must go like $y''(x),$ but we expect this to work like a spring energy and therefore to be squared. We also expect some force $F(x)$ to do some work on the beam. This all causes $$L = \int_0^\ell dx~\left(\frac 12 \lambda(x)~\big[\dot y(x)\big]^2 - \frac12 \alpha(x) \big[y''(x)\big]^2 + F(x)~y(x)\right).$$
We run the exact same argument except instead of $ds$ where $s \in [0, 1]$ we are now considering a $ds^2 = ds_1~ds_2$ where $(s_1, s_2) \in [0, 1]\times[0, 1],$ the resulting "Lagrangian" is usually called a "Lagrangian density." But the same method of argumentation is held all the way through: $y'$ and $y''$ are considered, for the Langrangian density $\mathcal L$'s sake, to be totally independent from each other and $y$ and $\dot y$, which are also considered to be independent from each other. The Euler-Lagrange equations now become:
$$
\frac{\partial\mathcal L}{\partial y} - \frac{\partial}{\partial t}\frac{\partial\mathcal L}{\partial \dot y} - \frac{\partial }{\partial x} \frac{\partial\mathcal L}{\partial y'} + \frac{\partial ^2}{\partial x^2} \frac{\partial\mathcal L}{\partial y''} = 0.$$ We therefore derive the beam equation as,$$F(x) - \lambda(x)~\ddot y - \frac{\partial^2}{\partial x^2}\big(\alpha(x)~y''(x,t)\big) = 0.$$In the case where $\alpha$ is constant and we achieve a steady-state, we see that what's here is some expression $y^{(4)}(x) = F(x)/\alpha:$ it is the fourth derivative that is important when we are considering beam loading. This is the Euler-Bernoulli beam theory in a nutshell and it is a very complicated thing to derive for engineers, who have to think about "bending moments" and "neutral axes" and such: but us physicists who have the benefit of stealing all the mathematicians' goodies are able to just "see" the answer from what the Lagrangian "should be."
So the first definition is wrong in an important way
I mean, definitions per se can't be wrong, but they can be useless, and that's precisely what we see above. What we want is to be able to say "for the paths that we care about the functional derivative of the action with respect to the path is zero", and the first definition only captures that in the most common case. The second definition is instead capturing this in a more general sense.