Mosasauroidea / GazellePW

Movie-based Gazelle
MIT License
243 stars 58 forks source link

SQL error while creating a User #37

Closed IITuxtmuxII closed 1 year ago

IITuxtmuxII commented 1 year ago

Hi when I try to register a User I get this error:

Fatal error: Uncaught DB_MYSQL_Exception: MySQL: Invalid Query: INSERT INTO users_info (UserID, StyleID, AuthKey, Inviter, JoinDate, AdminComment, Info, Avatar, SiteOptions, Warned, SupportFor, TorrentGrouping, ResetKey, ResetExpires, RatioWatchEnds, BanDate, InfoTitle) VALUES ('6', '35', 'c1d6ee9301ce9ae1a73e6e9446dc92e2', '0', '2022-10-30 23:05:52', '', '', '', '', '0000-00-00 00:00:00', '', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '') SQL error: 1364 (Field 'SettingTorrentTitle' doesn't have a default value) in /var/www/classes/mysql.class.php on line 199
--

I also wanted to ask if there is an admin account already installed?

120318 commented 1 year ago

This error is due to Mysql is using strict mode, your system is windows?

IITuxtmuxII commented 1 year ago

I use ubuntu 20.04 on an vps

120318 commented 1 year ago

I can't reproduce it, you could check the sql_mode in your mysql container config. the right mode should like below.

sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
IITuxtmuxII commented 1 year ago

Hi here is the config

[mysqld] sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION innodb_strict_mode = 0; character-set-server=utf8mb4

IITuxtmuxII commented 1 year ago

here is the docker-compose.yml as well

version: '3'

services:
  web:
    build: .
#    platform: linux/amd64
    container_name: gpw-web
    ports:
      - 9000:80
      - 9002:9002 # vite
      - 35729:35729 # livereload
    depends_on:
      - memcached
      - mysql
    volumes:
      - .:/var/www:delegated
      - node-modules:/var/www/node_modules
      - .docker/web/nginx.conf:/etc/nginx/sites-enabled/gazelle.conf
      - .docker/web/www.conf:/etc/php/7.3/fpm/pool.d/www.conf
    environment:
      # These should match what you set for your mysql container below
      - MYSQL_USER=gazelle
      - MYSQL_PASSWORD=password

  memcached:
    image: memcached:1.5-alpine
    container_name: gpw-memcached
  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: gpw-phpmyadmin
    environment:
      - PMA_HOST=mysql
      - PMA_USER=gazelle
      - PMA_PASSWORD=password
    depends_on:
      - mysql
    ports:
      - 9001:80
  mysql:
    image: mariadb:10.3
    container_name: gpw-mysql
    ports:
      - 36000:3306
    volumes:
      - ./.docker/mysql/mysqld_sql_mode.cnf:/etc/mysql/conf.d/mysqld_sql_mode.cnf:delegated
      - mysql-data:/var/lib/mysql
      - ./gazelle.sql:/docker-entrypoint-initdb.d/gazelle.sql:ro
    environment:
      - MYSQL_DATABASE=gazelle
      - MYSQL_USER=gazelle
      - MYSQL_PASSWORD=password
      - MYSQL_ROOT_PASSWORD=em%G9Lrey4^N

  manticoresearch:
    build: ./.docker/manticore
 #   platform: linux/amd64
    container_name: gpw-manticoresearch
    depends_on:
      - mysql
      - web
    volumes:
      - manticore-data:/var/lib/manticore
      - ./.docker/manticore/manticore.conf:/var/lib/manticore/conf/manticore.conf
    environment:
      # These should match what you set for your mysql container above
      - MYSQL_USER=gazelle
      - MYSQL_PASSWORD=password

volumes:
  node-modules: #~/data_node
  mysql-data: #~/data
  manticore-data: #~/manti
120318 commented 1 year ago

prune the mysql-data volume and re up docker-composer, see if there is an error in mysql container log.
Or if you familiar with, you can debug mysql issue by yourself.

IITuxtmuxII commented 1 year ago

I can only find this in the errorlogs this was in the nginx-error.log:

`2022/11/07 17:21:51 [error] 180#180: *11 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught DB_MYSQL_Exception: MySQL: Invalid Query: INSERT INTO users_info (UserID, StyleID, AuthKey, Inviter, JoinDate, AdminComment, Info, Avatar, SiteOptions, Warned, SupportFor, TorrentGrouping, ResetKey, ResetExpires, RatioWatchEnds, BanDate, InfoTitle) VALUES ('1', '35', 'ccdfb50433a8a73395de7afd2b58bbe2', '0', '2022-11-07 17:21:51', '', '', '', '', '0000-00-00 00:00:00', '', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '') SQL error: 1364 (Field 'SettingTorrentTitle' doesn't have a default value) in /var/www/classes/mysql.class.php:199 Stack trace:

0 /var/www/classes/mysql.class.php(406): DB_MYSQL->halt('Invalid Query: ...')

1 /var/www/classes/mysql.class.php(257): DB_MYSQL->attempt_query('\n\t\t\t\tINSERT INT...', Object(Closure), 1)

2 /var/www/sections/register/index.php(192): DB_MYSQL->query('\n\t\t\t\tINSERT INT...')

3 /var/www/classes/script_start.php(447): require('/var/www/sectio...')

4 /var/www/pu" while reading response header from upstream, client: [IP], server: localhost, request: "POST /register.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "tracker.Domain.xyz", referrer: "https://tracker.domain.xyz/register.php"

`

120318 commented 1 year ago

Hi here is the config

[mysqld] sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION innodb_strict_mode = 0; character-set-server=utf8mb4

This config file does not take effect, you need to check the docker mysql startup log.