github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/pkg/ddevapp/global_dotddev_assets/commands/host/mysqlworkbench.example (about)

     1  #!/bin/bash
     2  
     3  ## #ddev-generated
     4  ## Description: Run MySQLWorkbench against current db
     5  ## Usage: mysqlworkbench
     6  ## Example: "ddev mysqlworkbench"
     7  
     8  # Note that this example uses $DDEV_HOST_DB_PORT to get the port for the connection
     9  # Mysql Workbench can be obtained from https://dev.mysql.com/downloads/workbench/
    10  
    11  if [ "${DDEV_PROJECT_STATUS}" != "running" ] && [ -z "$no_recursion" ]; then
    12    echo "Project ${DDEV_PROJECT} is not running, starting it"
    13    ddev start
    14    start_exit_code=$?
    15    if [ $start_exit_code -ne 0 ]; then
    16      exit $start_exit_code
    17    fi
    18    # run this script again, as the environment is updated after "ddev start"
    19    no_recursion=true ddev "$(basename "$0")" "$@"
    20    exit $?
    21  fi
    22  query="root:root@127.0.0.1:${DDEV_HOST_DB_PORT}"
    23  
    24  case $OSTYPE in
    25    linux-gnu)
    26      # You may need "apt-get install libproj-dev gnome-keyring" if it complains about those
    27      mysql-workbench --query  "$query" &
    28      echo "Attempted to launch mysql-workbench"
    29      ;;
    30  
    31    "darwin"*)
    32      "/Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench" --query "$query" &
    33      echo "Attempted to launch MySQLWorkbench.app"
    34      ;;
    35  
    36    "win*"* | "msys"*)
    37      # 'C:\Program Files\MySQL\MySQL Workbench 8.0 CE\mysqlworkbench.exe'
    38      # You may need to add it to your system %PATH% or change the path here
    39      'C:\Program Files\MySQL\MySQL Workbench 8.0 CE\mysqlworkbench.exe' --query "$query"
    40      #;;
    41  esac