[Archive] SQL updates en mass
[Archive] SQL updates en mass
Archived author: DrkJstr • Posted: 2025-11-04T18:04:29.298535
Original source
I've seen many tutorials (mainly for windows) where tutorial has you 'batch' all the SQL files into a a single *.sql and then the user would import that single file. There are some un-discussed issues with that method;
This method does not allow easy identification of errors that might occur during the import of the query.
This method could produce a large file that takes some time to load into memory and/or process
Not to mention the batch process isn't needed; everyone should already have all the tools they need in order to just import the updates 'en mass'. Here are the scripts to use...
Windows Version
Code:
for /f %%a in ('dir /b *world*.sql') do "C:\PROGRA~1\MySQL\MYSQLS~1.5\bin\mysql.exe" -u [MYSQL User] --password=[User's Password] --database=[Database] < %%a
Linux Version
Code:
for file in *world*.sql; do mysql -u [MYSQL User] --password=[User's Password] [Database] < $file; done
Both examples assume the MySQL Server is running on localhost, if not add -h [Host IP] to the script(s).
Enjoy
~DrkJstr