@@ -156,36 +156,20 @@ else if (running)
156156 haltWithException (e );
157157 }
158158
159- // ── 1b. Verify mysqld process is alive on port 3306 ─── ─────────────────
160- try
159+ // ── 1b. Verify mysqld daemon is reachable on port 3306 ─────────────────
160+ try ( java . net . Socket sock = new java . net . Socket ())
161161 {
162- ProcessBuilder pb = new ProcessBuilder ("cmd.exe" , "/c" , "netstat" , "-ano" , "|" , "findstr" , "3306" );
163- pb .redirectErrorStream (true );
164- Process proc = pb .start ();
165- String output = new BufferedReader (new InputStreamReader (proc .getInputStream ()))
166- .lines ().collect (Collectors .joining ("\n " ));
167- proc .waitFor ();
168-
169- if (output .contains ("LISTENING" ))
170- {
171- CommonRails .printSystemComponent (this , this .hashCode (),
172- ". MYSQLD — daemon LISTENING on port 3306 ." ,
173- ColorPalette .COLOR_LIME_GREEN );
174- }
175- else
176- {
177- CommonRails .printSystemComponent (this , this .hashCode (),
178- ". MYSQLD — no daemon listening on port 3306 ." ,
179- ColorPalette .COLOR_STANDARD_RED );
180- haltWithException (new RuntimeException ("mysqld not listening on port 3306 — daemon may not have started" ));
181- }
162+ sock .connect (new java .net .InetSocketAddress ("127.0.0.1" , PORT ), 3000 );
163+ CommonRails .printSystemComponent (this , this .hashCode (),
164+ ". MYSQLD — daemon reachable on port " + PORT + " ." ,
165+ ColorPalette .COLOR_LIME_GREEN );
182166 }
183167 catch (Exception e )
184168 {
185169 CommonRails .printSystemComponent (this , this .hashCode (),
186- ". MYSQLD port check failed : " + e .getMessage () + " ." ,
170+ ". MYSQLD — daemon NOT reachable on port " + PORT + " : " + e .getMessage () + " ." ,
187171 ColorPalette .COLOR_STANDARD_RED );
188- haltWithException (e );
172+ haltWithException (new RuntimeException ( "mysqld not reachable on port " + PORT ) );
189173 }
190174
191175 // ── 2. JDBC login test using credentials from mysql.auth.xml ──────────
0 commit comments