[Check out the Democratic field with our new candidate tracker.]

The mayor praised Ms. Harris and said he was “proud” and “excited” about her candidacy; he did not make any endorsements, however. He also had good words for several Democrats who are now considering 2020 bids: He said Senator Cory Booker of New Jersey was a close friend of many years, and called former New York City Mayor Michael R. Bloomberg a “good friend and mentor.”

Asked if he would consider being a vice-presidential candidate, he said, “I think I got a better job than that.”

Mr. Garcetti, 47, is a former Rhodes Scholar who has spent much of his professional life in city government, and reflects the diversity of the city he leads, with Italian, Jewish and Mexican roots. In a city that is majority Latino, Mr. Garcetti, when speaking publicly, often switches back and forth between English and Spanish. He grew up as the son of a prominent public official in the city — his father, Gil Garcetti, is a former district attorney who became nationally known as the prosecutor leading the O.J. Simpson trial.

Mr. Garcetti, along with other leaders in a state that has steadily become more liberal, has eagerly touted Los Angeles — and California — as a counterweight to the agenda of President Trump, giving him a national profile that he, at one point, thought could make him a viable national candidate. He has embraced Los Angeles’s role as a sanctuary city that protects undocumented immigrants from federal immigration authorities, and sought to shape the agenda of the Democratic Party by pushing for more liberal policy goals.

In an interview in late 2017 with The New York Times, as he was already thinking about running for president, Mr. Garcetti described himself as a member of the “impatient next generation” of Democratic leaders.