Search code examples
mysqlgitpod

Login mysql on gitpod


I started a fresh project using gitpod. I did the regular npm init and I'm using express, hbs. On my terminal, when I entered "mysql -u root" It says "bash: mysql: command not found"


Solution

  • You'll need to install mysql first. Try using a custom docker image - gitpod/workspace-mysql

    File: .gitpod.yml

    image:
      file: .gitpod.dockerfile
    

    File: .gitpod.dockerfile

    FROM gitpod/workspace-mysql
    

    You'll likely need to create a user with a password for your application to connect.

    mysql -e "CREATE DATABASE my_db;"
    mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root_password';"