質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.33%
SQL

SQL(Structured Query Language)は、リレーショナルデータベース管理システム (RDBMS)のデータベース言語です。大きく分けて、データ定義言語(DDL)、データ操作言語(DML)、データ制御言語(DCL)の3つで構成されており、プログラム上でSQL文を生成して、RDBMSに命令を出し、RDBに必要なデータを格納できます。また、格納したデータを引き出すことも可能です。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

MariaDB

MariaDBは、MySQL派生のオープンソースなリレーショナルデータベースシステムです。 また、MySQLとほぼ同じデータベースエンジンに対応しています。

XAMPP

XAMPP(ザンプ)は、ウェブアプリケーションの実行に必要なフリーソフトウェアをパッケージングしたApacheディストリビューションです。 XAMPPひとつインストールするだけで、Apache、MySQL、PHP、Perlなどのソフトウェアと、 phpMyAdminなどの管理ツール、SQLiteなどのソフトウェアやライブラリモジュールなどを利用することが可能です。

Q&A

0回答

115閲覧

XAMMP(mariadb+php) にてSQLが途中で止まる

dendoushishi

総合スコア9

SQL

SQL(Structured Query Language)は、リレーショナルデータベース管理システム (RDBMS)のデータベース言語です。大きく分けて、データ定義言語(DDL)、データ操作言語(DML)、データ制御言語(DCL)の3つで構成されており、プログラム上でSQL文を生成して、RDBMSに命令を出し、RDBに必要なデータを格納できます。また、格納したデータを引き出すことも可能です。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

MariaDB

MariaDBは、MySQL派生のオープンソースなリレーショナルデータベースシステムです。 また、MySQLとほぼ同じデータベースエンジンに対応しています。

XAMPP

XAMPP(ザンプ)は、ウェブアプリケーションの実行に必要なフリーソフトウェアをパッケージングしたApacheディストリビューションです。 XAMPPひとつインストールするだけで、Apache、MySQL、PHP、Perlなどのソフトウェアと、 phpMyAdminなどの管理ツール、SQLiteなどのソフトウェアやライブラリモジュールなどを利用することが可能です。

0グッド

0クリップ

投稿2025/02/18 04:33

編集2025/02/18 05:17

実現したいこと

SQLのLOOP処理をしているが、テーブルの容量が大きくなっても途中で止まらないようにしたい。
多分、mariaDB の設定を変更すれば動きそうな気がします。
ちなみに、XAMMP(SQLite+php) で動いていた PHPプログラムを MariaDB用に書き換えています。
途中までLOOPしているので、書き換えた部分は問題無い物と思っています。

発生している問題・分からないこと

このテーブルにデーターが入らないようにプログラムを変更すると、最後までLOOP処理される。
途中まではテーブルにデーター蓄積されているので、プログラムやデーターには原因はなさそう。
下記、エラーメッセージに XAMMP コントロールパネルで開いた MySQL loggs を記載します。

エラーメッセージ

error

1以下、XAMMP コントロールパネルで開いた MySQL loggs 内容です。 2 32025-02-18 13:04:05 0 [Note] Starting MariaDB 10.4.32-MariaDB source revision c4143f909528e3fab0677a28631d10389354c491 as process 24408 42025-02-18 13:04:05 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 52025-02-18 13:04:05 0 [Note] InnoDB: Uses event mutexes 62025-02-18 13:04:05 0 [Note] InnoDB: Compressed tables use zlib 1.3 72025-02-18 13:04:05 0 [Note] InnoDB: Number of pools: 1 82025-02-18 13:04:05 0 [Note] InnoDB: Using SSE2 crc32 instructions 92025-02-18 13:04:05 0 [Note] InnoDB: Initializing buffer pool, total size = 10G, instances = 8, chunk size = 128M 102025-02-18 13:04:05 0 [Note] InnoDB: Completed initialization of buffer pool 112025-02-18 13:04:06 0 [Note] InnoDB: 128 out of 128 rollback segments are active. 122025-02-18 13:04:06 0 [Note] InnoDB: Creating shared tablespace for temporary tables 132025-02-18 13:04:06 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 142025-02-18 13:04:06 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB. 152025-02-18 13:04:06 0 [Note] InnoDB: Waiting for purge to start 162025-02-18 13:04:06 0 [Note] InnoDB: 10.4.32 started; log sequence number 16746547497; transaction id 4480427 172025-02-18 13:04:06 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool 182025-02-18 13:04:06 0 [Note] Plugin 'FEEDBACK' is disabled. 192025-02-18 13:04:06 0 [Note] Server socket created on IP: '::'. 202025-02-18 13:04:06 0 [Note] Reading of all Master_info entries succeeded 212025-02-18 13:04:06 0 [Note] Added new Master_info '' to hash table 222025-02-18 13:04:06 0 [Note] C:\xampp\mysql\bin\mysqld.exe: ready for connections. 23Version: '10.4.32-MariaDB' socket: '' port: 3306 mariadb.org binary distribution 242025-02-18 13:04:06 0 [Note] InnoDB: Buffer pool(s) load completed at 250218 13:04:06

該当のソースコード

my.ini

1# Example MySQL config file for small systems. 2# 3# This is for a system with little memory (<= 64M) where MySQL is only used 4# from time to time and it's important that the mysqld daemon 5# doesn't use much resources. 6# 7# You can copy this file to 8# C:/xampp/mysql/bin/my.cnf to set global options, 9# mysql-data-dir/my.cnf to set server-specific options (in this 10# installation this directory is C:/xampp/mysql/data) or 11# ~/.my.cnf to set user-specific options. 12# 13# In this file, you can use all long options that a program supports. 14# If you want to know which options a program supports, run the program 15# with the "--help" option. 16 17# The following options will be passed to all MySQL clients 18[client] 19character-set-server=utf8 20# password = your_password 21port=3306 22socket="C:/xampp/mysql/mysql.sock" 23 24 25# Here follows entries for some specific programs 26 27# The MySQL server 28default-character-set=utf8mb4 29[mysqld] 30character-set-server=utf8 31skip-character-set-client-handshake 32port=3306 33socket="C:/xampp/mysql/mysql.sock" 34basedir="C:/xampp/mysql" 35tmpdir="C:/xampp/tmp" 36datadir="C:/xampp/mysql/data" 37pid_file="mysql.pid" 38# enable-named-pipe 39key_buffer=16M 40 41#2025.02.18 42#max_allowed_packet=1M 43#max_allowed_packet=4M 44 45# 2025.02.14 https://runebook.dev/ja/articles/mariadb/mariadb-memory-allocation/index 46# 2025.02.18 512k -> 40M -> 512M 47sort_buffer_size=512M 48 49net_buffer_length=8K 50read_buffer_size=256K 51read_rnd_buffer_size=512K 52myisam_sort_buffer_size=8M 53log_error="mysql_error.log" 54 55# Change here for bind listening 56# bind-address="127.0.0.1" 57# bind-address = ::1 # for ipv6 58 59# Where do all the plugins live 60plugin_dir="C:/xampp/mysql/lib/plugin/" 61 62# Don't listen on a TCP/IP port at all. This can be a security enhancement, 63# if all processes that need to connect to mysqld run on the same host. 64# All interaction with mysqld must be made via Unix sockets or named pipes. 65# Note that using this option without enabling named pipes on Windows 66# (via the "enable-named-pipe" option) will render mysqld useless! 67# 68# commented in by lampp security 69#skip-networking 70#skip-federated 71 72# Replication Master Server (default) 73# binary logging is required for replication 74# log-bin deactivated by default since XAMPP 1.4.11 75#log-bin=mysql-bin 76 77# required unique id between 1 and 2^32 - 1 78# defaults to 1 if master-host is not set 79# but will not function as a master if omitted 80server-id =1 81 82# Replication Slave (comment out master section to use this) 83# 84# To configure this host as a replication slave, you can choose between 85# two methods : 86# 87# 1) Use the CHANGE MASTER TO command (fully described in our manual) - 88# the syntax is: 89# 90# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>, 91# MASTER_USER=<user>, MASTER_PASSWORD=<password> ; 92# 93# where you replace <host>, <user>, <password> by quoted strings and 94# <port> by the master's port number (3306 by default). 95# 96# Example: 97# 98# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306, 99# MASTER_USER='joe', MASTER_PASSWORD='secret'; 100# 101# OR 102# 103# 2) Set the variables below. However, in case you choose this method, then 104# start replication for the first time (even unsuccessfully, for example 105# if you mistyped the password in master-password and the slave fails to 106# connect), the slave will create a master.info file, and any later 107# change in this file to the variables' values below will be ignored and 108# overridden by the content of the master.info file, unless you shutdown 109# the slave server, delete master.info and restart the slaver server. 110# For that reason, you may want to leave the lines below untouched 111# (commented) and instead use CHANGE MASTER TO (see above) 112# 113# required unique id between 2 and 2^32 - 1 114# (and different from the master) 115# defaults to 2 if master-host is set 116# but will not function as a slave if omitted 117#server-id = 2 118# 119# The replication master for this slave - required 120#master-host = <hostname> 121# 122# The username the slave will use for authentication when connecting 123# to the master - required 124#master-user = <username> 125# 126# The password the slave will authenticate with when connecting to 127# the master - required 128#master-password = <password> 129# 130# The port the master is listening on. 131# optional - defaults to 3306 132#master-port = <port> 133# 134# binary logging - not required for slaves, but recommended 135#log-bin=mysql-bin 136 137 138# Point the following paths to different dedicated disks 139#tmpdir = "C:/xampp/tmp" 140#log-update = /path-to-dedicated-directory/hostname 141 142# Uncomment the following if you are using BDB tables 143#bdb_cache_size = 4M 144#bdb_max_lock = 10000 145 146# Comment the following if you are using InnoDB tables 147#skip-innodb 148innodb_data_home_dir="C:/xampp/mysql/data" 149innodb_data_file_path=ibdata1:10M:autoextend 150innodb_log_group_home_dir="C:/xampp/mysql/data" 151#innodb_log_arch_dir = "C:/xampp/mysql/data" 152## You can set .._buffer_pool_size up to 50 - 80 % 153## of RAM but beware of setting memory usage too high 154 155## 2025.02.18 chaange 156##innodb_buffer_pool_size=16M 157innodb_buffer_pool_size=10G 158 159## Set .._log_file_size to 25 % of buffer pool size 160## 2025.02.18 chaange 161##innodb_log_file_size=5M 162##innodb_log_buffer_size=8M 163innodb_log_file_size=1G 164innodb_log_buffer_size=512M 165 166innodb_flush_log_at_trx_commit=1 167innodb_lock_wait_timeout=50 168 169## UTF 8 Settings 170#init-connect=\'SET NAMES utf8\' 171#collation_server=utf8_unicode_ci 172#character_set_server=utf8 173#skip-character-set-client-handshake 174#character_sets-dir="C:/xampp/mysql/share/charsets" 175sql_mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION 176log_bin_trust_function_creators=1 177 178character-set-server=utf8mb4 179collation-server=utf8mb4_general_ci 180[mysqldump] 181max_allowed_packet=200M 182 183[mysql] 184# Remove the next comment character if you are not familiar with SQL 185#safe-updates 186 187[isamchk] 188key_buffer=20M 189sort_buffer_size=20M 190read_buffer=20M 191write_buffer=20M 192 193[myisamchk] 194key_buffer=20M 195sort_buffer_size=20M 196read_buffer=20M 197write_buffer=20M 198 199[mysqlhotcopy] 200

試したこと・調べたこと

  • teratailやGoogle等で検索した
  • ソースコードを自分なりに変更した
  • 知人に聞いた
  • その他
上記の詳細・結果

ネット情報を見て my.ini を色々と変更しましたが上手く行きませんでした。
現状設定状況は上記を参照して下さい。
また、PCのタスクマネージャー状況を添付します。
PHP動作中もメモリー容量は殆ど変化しませんでした。イメージ説明

補足

データーを少なくしてLOOPを抜けた状態のデバッグ画面
イメージ説明

LOOPから抜けない状態のデバッグ画面
イメージ説明

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

maisumakun

2025/02/18 04:39

「途中で止まる」とは「サーバが落ちる」なのか「応答がなくなる」のか、あるいはそのいずれでもない事象なのか、どういう状況なのでしょうか。 あと、SQLを呼ぶコードの側もご提示いただければ幸いです。
dendoushishi

2025/02/18 05:18

まいすまくん 様 コメントありがとうございます! PHP デバッグの為、sql結果を print・var_dump 等で ブラウザ表示しながらデバッグしております。 データーを少なくして LOOPを抜けた状態と LOOPから抜けてこない状態の画面を添付致します。 初心者なので、「サーバが落ちる」なのか「応答がなくなる」のか、あるいはそのいずれでもない事象なのか が分かっておりません・・・ デバッグ画面を追加しましたので、ご確認をお願い致します。 お手数をお掛けしますが、アドバイス頂ければ助かります。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.33%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問