The characteristic of a field is defined to be the smallest positive integer $p$ such that $$p \cdot 1 = 0.$$
But I have learned that field has no zero divisors. How is this possible?
The characteristic of a field is defined to be the smallest positive integer $p$ such that $$p \cdot 1 = 0.$$
But I have learned that field has no zero divisors. How is this possible?
The notation $p \cdot 1$ just means $1+1+\cdots+1$ ($p$ times), where $1$ is the unit of the field and $+$ is the addition in the field.
You can also interpret $p$ as this same element in the field, but in this case you'll have $p=0$.
For any unital ring $R$, fields included, and for any $n \in \Bbb Z_{\geq 0}$, we denote $$n \cdot 1 := \underbrace{1 + \cdots + 1}_n.$$ Now, $n \mapsto n \cdot 1$ is by construction a group homomorphism $$\phi: (\mathbb{Z}, +) \to (R, +) ,$$ (to achieve this we need to declare for $-m < 0$ that $(-m) \cdot 1 = -(m \cdot 1)$) and we define the characteristic of $R$ to be the additive order $c$ of the multiplicative unit $\phi(1) = 1_R$ of $R$, or more informally, "$c = 0$ in $R$". (If $n \cdot 1 \neq 0$ for all positive integers $n$, we usually say by convention that the field has characteristic $0$; some older sources say such fields have characteristic $\infty$ instead.)
Example Consider the field $\mathbb{F}_2$ with underlying set $\{0, 1\}$, with elements just an additive and multiplicative identity (respectively) and satisfying $1 + 1 := 0$. Since $0 \neq 1$, the characteristic of this field is $\operatorname{char} \mathbb{F}_2 = 2$.
Remark If the characteristic $c$ of a ring is positive and composite, say, $c = kl$ for $k, l > 1$, then $$\phi(k) \phi(l) = \phi(kl) = \phi(c) = 0 ,$$ so $\phi(k)$ and $\phi(l)$ (which are nonzero, because $k, l$ are both smaller than $c$) are zero divisors. In particular, the characteristic of any field must be $0$ or prime.
If $R$ is a ring with identity, let's denote it by $1$. Let's also denote integers with boldface type. So $\mathbf{1}$ is the integer number one, for instance, $\mathbf{0}$ is the integer zero, whereas $0$ and $1$ are the neutral elements in $R$.
Since $R$ under addition is an abelian group, we can as usual define $$\def\z#1{\mathbf{#1}} \z{0}r=0,\qquad (\z{n}+\z{1})r=\z{n}r+r $$ that defines $\z{n}r$ for $\z{n}\ge\z{0}$. If $\z{n}<\z{0}$, define as usual $$ \z{n}r=(-\z{n})(-r) $$ It's easy to prove that, if $\varepsilon_R\colon\mathbb{Z}\to R$ is the map $$ \varepsilon_R(\z{n})=\z{n}1 $$ (according to the definition above), then
so $\varepsilon_R$ is a homomorphism of unital rings. Actually it is the unique unital ring homomorphism $\mathbb{Z}\to R$, because $\mathbb{Z}$ is a cyclic group under addition and we're required that a homomorphism maps $\z{1}$ into $1$.
Like all ring homomorphisms, $\varepsilon_R$ has a kernel which is an ideal of $\mathbb{Z}$, so we have $\ker\varepsilon_R=\z{k}\mathbb{Z}$ for a unique $\z{k}\ge\z{0}$.
If $\z{k}=\z{0}$, then $\varepsilon_R$ is injective. Otherwise, we have $$ \z{k}1=0 $$ by definition of kernel, which means that $$ \z{k}r=\underbrace{r+r+\dots+r}_{\z{k}}=(\underbrace{1+1+\dots+1}_{\z{k}})r= (\z{k}1)r=0r=0 $$ for every $r\in R$.
This integer $\z{k}$ is the characteristic of $R$.
If $R$ is an integral domain and $\z{k}>\z{0}$, suppose we have $\z{k}=\z{a}\z{b}$, with $\z{1}\le\z{a}<\z{k}$. Then, by definition of the characteristic, we know $\z{a}1\ne0$, but $$ 0=\z{k}1=\varepsilon_R(\z{k})=\varepsilon_R(\z{a})\varepsilon_R(\z{b}) $$ and so, being $R$ an integral domain, we have $\varepsilon_R(\z{b})=0$ which implies $\z{k}\mid\z{b}$. Therefore $\z{b}=\z{k}$ and $\z{a}=1$. It follows that $\z{k}$ is prime.
Saying $\z{k}1=0$ in a field (which is an integral domain) is not a contradiction, because $\z{k}$ is not an element of the field.
Normally one doesn't denote integers with different type than elements of the rings, which could lead to confusion. Most of the times, one simply writes $n$ instead of $n1$ (when $n$ is an integer), so we can even find $p=0$ when the characteristic of a field is the prime $p$. This should be simply interpreted as $p1=0$. With some experience, the notational problems disappear.
Indeed a field is always an integral domain.
But having finite characteristic $p$ doesn't contradict this statement, as, as borne out in the comments and the other answers, $px=0$ doesn't refer to a product of nonzero field elements, but rather to repeated addition of the field element $x$ with itself. Remember, a field is a ring, and a ring consists in an additive abelian group, hence a $\Bbb Z$- module, among other things. Thus $px$ makes sense, and it being equal to zero is perfectly legal.