User Tools

Site Tools


unraid:dockers:mysql

This is an old revision of the document!


MySQL

MySQL is an open-source relational database management system. Its name is a combination of “My”, the name of co-founder Michael Widenius's daughter, and “SQL”, the abbreviation for Structured Query Language. Brimble.com uses MySQL to store the tables for most all things running on the server.

Version

I used the official docker from Bungy's repository.

Docker Setup

  • Network Type: Custom: brimble
  • Fixed IP address (optional): blank
  • Console shell command: Shell
  • Privileged: off
  • Host Port 1: 3306
  • Host Path 1: /mnt/disks/samsung_ssd/appdata/mysql
  • Key 1 (MYSQL_ROOT_PASSWORD):
  • Key 2 (MYSQL_DATABASE): nextcloud (i used this to create the nexcloud structure… added more later)
  • Key 3 (MYSQL_USER):
  • Key 4 (MYSQL_PASSWORD):

App Settings

  • User standard SQL commands to import databases from back up, allow privileges, etc.
  • See Install MySql section of installing ubuntu pages for most commands. write access is not needed as that feature was removed by changing the way the NCAA pool temp stores the data.

Connect

docker exec -it mysql bash

Load Football pool

  • Create csv file
  • Cyberduck it over to tmp folder on unraid server
  • copy it to tmp folder on docker
    docker cp /tmp/2021.csv mysql:/tmp/2021.csv
  • go back to docker console, copy it to mysql-files directory
     cp /tmp/2021.csv /var/lib/mysql-files/2021.csv
  • log into mysql
  • check LOCAL INFILE var
     mysql> show global variables like 'local_infile';
  • fix it if need be
     mysql> set global local_infile=true;
  • log out of mysql and back in with proper option
     mysql --local_infile=1 -u root -ppassword DB_name
  • Use normal commands
    LOAD DATA LOCAL INFILE "/var/lib/mysql/2021.csv" INTO TABLE games COLUMNS TERMINATED BY ',';
    UPDATE games SET vscore = NULL where year = 2021;
    UPDATE games SET hscore = NULL where year = 2021;

Adjust Max Connections

  • show processlist;
  • show variables like '%timeout';
  • Either use vs-code setup to edit my.cnf from /etc folder OR copy my.cnf from /etc folder in the docker to the server for editing
    docker cp mysql:/etc/my.cnf .
  • add following lines to my.cnf (put them just under the [mysqld] line… putting them under [client] is no bueno!
    [mysqld]
    
    wait_timeout = 300
    interactive_timeout = 300
    max_connections = 300
  • copy my.cnf back to docker
    cp my.cnf mysql:/etc/my.cnf
  • restart docker
unraid/dockers/mysql.1676146997.txt.gz · Last modified: by dirk