Skip to content

Latest commit

 

History

History
55 lines (44 loc) · 2.33 KB

mysql.md

File metadata and controls

55 lines (44 loc) · 2.33 KB

MySQL as on-line source/target

1. Preconditions for OS Windows

  • Install Desktop Docker, see

2. Run MySQL (in container)

  1. Get image from official source

    • get specific mysql image version 9.0.1 docker pull mysql:9.0.1
    • or get last mysql image docker pull mysql:latest
    • Note
  2. Run new container

    • create container with name 'mlrun-mysql', use image 'mysql:9.0.1' and open ports 3306:3306
      • docker run --name mlrun-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=jist -e MYSQL_DATABASE=test -e MYSQL_USER=testuser -e MYSQL_PASSWORD=testpwd -d mysql:9.0.1 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    • or create container with name 'mlrun-mysql', use image 'mysql:latest' and open ports 3306:3306
      • docker run --name mlrun-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=jist -e MYSQL_DATABASE=test -e MYSQL_USER=testuser -e MYSQL_PASSWORD=testpwd -d mysql:last --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    • NOTE:
      • user testuser, password testpwd
  3. Test MySQL in container

    • interactive access to the container
      • docker exec -it mlrun-mysql bash
    • login to mysql under the user 'root'
      • mysql -u root -p and password jist
    • show list of users
      • SELECT user FROM mysql.user;
    • show list of databases
      • show databases;
    • switch to use database test
      • use test;
    • show list of tables
      • show tables;

3. Use MySQL for tests

  • Update qgate-sln-mlrun.env, change setting for QGATE_MYSQL
    • format QGATE_MYSQL = mysql+<dialect>://<username>:<password>@<host>:<port>/<db_name>
    • see QGATE_MYSQL = mysql+pymysql://testuser:testpwd@localhost:3306/test
  • Note

4. Install these python packages

  • SQLAlchemy based on MLRun extras see pip install mlrun[sqlalchemy] or dependencies.py in MLRun
    • it required pip install sqlalchemy~=1.4
  • Dialect pymysql
    • it required pip install pymysql~=1.1
  • Cryptography support
    • it required pip install cryptography~=42.0
  • NOTE
    • these are versions valid for MLRun 1.6.2