> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL-Instrumentierung

export const Compatibility = ({versions = [], label = "Available in"}) => {
  if (!Array.isArray(versions) || versions.length === 0) {
    return null;
  }
  const defaultPillStyle = {
    borderColor: "#d4d4d8",
    background: "#f4f4f5",
    color: "#3f3f46"
  };
  const pillStyles = {
    "AppSignal for Elixir": {
      background: "#f3e8ff",
      borderColor: "#d8b4fe",
      color: "#6b21a8"
    },
    "AppSignal for Front-end": {
      background: "#fef9c3",
      borderColor: "#fde047",
      color: "#854d0e"
    },
    "AppSignal for Go": {
      background: "#ccfbf1",
      borderColor: "#5eead4",
      color: "#115e59"
    },
    "AppSignal for JavaScript": {
      background: "#fef9c3",
      borderColor: "#fde047",
      color: "#854d0e"
    },
    "AppSignal for Node.js": {
      background: "#dcfce7",
      borderColor: "#86efac",
      color: "#166534"
    },
    "AppSignal for Python": {
      background: "#dbeafe",
      borderColor: "#93c5fd",
      color: "#1e40af"
    },
    "AppSignal for Ruby": {
      background: "#fee2e2",
      borderColor: "#fca5a5",
      color: "#991b1b"
    },
    "AppSignal for Rust": {
      background: "#ffedd5",
      borderColor: "#fdba74",
      color: "#9a3412"
    }
  };
  const getPillStyle = name => ({
    ...defaultPillStyle,
    ...pillStyles[name] || ({})
  });
  return <div className="not-prose my-4 rounded-lg border border-zinc-200 bg-zinc-50 px-4 py-3 text-sm dark:border-white/10 dark:bg-white/5">
      <div className="flex flex-wrap items-center gap-x-2 gap-y-1">
        <span className="font-semibold text-zinc-700 dark:text-zinc-200">
          {label}:
        </span>
        {versions.map((v, i) => <span key={`${v.name}-${v.version}-${i}`} className="inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium" style={getPillStyle(v.name)}>
            <span>{v.name}</span>
            <span className="opacity-70">
              {v.version}
              {v.exact ? "" : "+"}
            </span>
          </span>)}
      </div>
    </div>;
};

## Installation

<Note>
  🐍 Vergessen Sie nicht, zuerst das [AppSignal for Python-Paket zu installieren](/python/installation) in Ihrer Anwendung.
</Note>

Die Installationsanleitung unterscheidet sich je nach verwendetem MySQL-Adapter-Paket:

* [`mysql`](#using-mysql) (aus dem Paket `mysql-connector-python`)
* [`mysqlclient`](#using-mysqlclient)
* [`pymysql`](#using-pymysql)

<Warning>
  Bei Verwendung von [SQLAlchemy](/python/instrumentations/sqlalchemy) installieren Sie diese Instrumentierungspakete **nicht**. Die Instrumentierung für SQLAlchemy instrumentiert automatisch Abfragen an die zugrunde liegende Datenbank. Die Installation beider Instrumentierungspakete führt zu doppelten Ereignissen.
</Warning>

### Verwendung von `mysql`

<Compatibility
  versions={[
{ name: "AppSignal for Python", version: "1.3.2" },
{ name: "mysql-connector-python", version: "8.0.0" },
]}
/>

Wenn Sie das MySQL-Adapter-Paket `mysql-connector-python` verwenden (das als `mysql` importiert wird), installieren Sie das Paket `opentelemetry-instrumentation-mysql`. Um es zu Ihrem Projekt hinzuzufügen, fügen Sie die folgende Zeile in Ihre `requirements.txt`-Datei ein:

<CodeGroup>
  ```python Python theme={null}

  <PythonDisableInstrumentations />
  # requirements.txt
  opentelemetry-instrumentation-mysql
  ```
</CodeGroup>

### Verwendung von `mysqlclient`

<Compatibility versions={[{ name: "AppSignal for Python", version: "1.3.2" }]} />

Wenn Sie das MySQL-Adapter-Paket `mysqlclient` verwenden, installieren Sie das Paket `opentelemetry-instrumentation-mysqlclient`. Um es zu Ihrem Projekt hinzuzufügen, fügen Sie die folgende Zeile in Ihre `requirements.txt`-Datei ein:

<CodeGroup>
  ```python Python theme={null}
  # requirements.txt
  opentelemetry-instrumentation-mysqlclient
  ```
</CodeGroup>

### Verwendung von `pymysql`

<Compatibility versions={[{ name: "AppSignal for Python", version: "1.3.2" }]} />

Wenn Sie das MySQL-Adapter-Paket `pymysql` verwenden, installieren Sie das Paket `opentelemetry-instrumentation-pymysql`. Um es zu Ihrem Projekt hinzuzufügen, fügen Sie die folgende Zeile in Ihre `requirements.txt`-Datei ein:

<CodeGroup>
  ```python Python theme={null}
  # requirements.txt
  opentelemetry-instrumentation-pymysql
  ```
</CodeGroup>
