Objective. To study the changes in the intestinal flora and its relationship with nutritional status for patients with cancer pain. Methods. A prospective research method was adopted. One hundred twenty cancer patients with cancer pain were selected as the research objects, who were treated in our hospital from June 2019 to June 2020, and 120 cancer patients without cancer pain were selected as the control group, who were treated in the same period. The differences of the intestinal flora and nutritional status of patients with different severity between the observation group and the control group were compared to analyze the changes of intestinal flora in patients with cancer pain and its correlation with nutritional status. Results. Hemoglobin (HB) (
t
=
17.141
,
p
≤
0.001
), albumin (ALB) (
t
=
27.654
,
p
≤
0.001
), prealbumin (PAB) (
t
=
96.192
,
p
≤
0.001
), and total protein (TP) (
t
=
18.781
,
p
≤
0.001
) in the observation group were significantly lower than those in the control group. There were statistically significant differences in HB (
f
=
13.569
,
p
≤
0.001
), ALB (
f
=
22.229
,
p
≤
0.001
), PAB (
f
=
19.521
,
p
≤
0.001
), and TP (
f
=
21.451
,
p
≤
0.001
) among patients with cancer pain of different severity. Through these two comparisons, their nutritional indicators showed a significant downward trend with the increase in the severity for cancer pain patients; the levels of Lactobacillus (
t
=
2.124
,
p
=
0.035
), Bifidobacterium (
t
=
4.823
,
p
≤
0.001
), Enterococcus (
t
=
3.578
,
p
≤
0.001
), and Eubacterium (
t
=
2.394
,
p
=
0.017
) in the observation group were significantly lower than those in the control group. There were statistically significant differences in the levels of Lactobacillus (
f
=
20.643
,
p
≤
0.001
), Bifidobacterium (
f
=
19.129
,
p
≤
0.001
), Enterococcus (
f
=
17.408
,
p
≤
0.001
), and Eubacterium (
f
=
22.343
,
p
≤
0.001
) among patients with cancer pain of different severity. After pairwise comparison, their beneficial intestinal bacteria were significantly lower than those in the control group with the increase in pain in cancer pain patients. Nitric oxide (NO) (
t
=
8.418
,
p
≤
0.001
), galectin-3 (
t
=
14.043
,
p
≤
0.001
), occludin (OCLN) (
t
=
47.308
,
p
≤
0.001
), galectin-1 (
t
=
15.298
,
p
≤
0.001
), zonula occludens protein 1 (ZO-1) (
t
=
23.093
,
p
≤
0.001
), and cingulin (
t
=
340.198
,
p
≤
0.001
) in the observation group were significantly lower than those in the control group. There were statistically significant differences in NO, galectin-3, OCLN, galectin-1, ZO-1, and cingulin for patients with cancer pain of different severity. By comparison, the NO, galectin-3, OCLN, galectin-1, ZO-1, and cingulin of the patients showed a significant downward trend with the aggravation of cancer pain symptoms. Through correlation analysis, the nutritional indicators of patients were positively correlated with intestinal microorganisms and intestinal barrier function. Conclusion. There was a significant correlation between the changes in intestinal flora and nutritional status for patients with cancer pain, which could be used as an important basis for improving the treatment of cancer pain.