Last active
December 5, 2019 08:03
-
-
Save AgungPambudi/6bd6b67599062e3d31738d82204d24a6 to your computer and use it in GitHub Desktop.
batch file to convert character set to latin1 in MySQL (All Tables)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM by Agung Pambudi | |
REM mail@agungpambudi.com | |
REM http://agungpambudi.com | |
REM _ _ _ | |
REM ___ ___ _ _ ___ ___ ___ ___ _____l l_ _ _ _l l_l ___ ___ _____ | |
REM l .'l . l l l l . l . l .'l l . l l l . l l_l _l . l l | |
REM l__,l_ l___l_l_l_ l _l__,l_l_l_l___l___l___l_l_l___l___l_l_l_l | |
REM l___l l___l_l | |
REM | |
REM Batch file to convert character set to latin1 in MySQL Table | |
:HSL | |
SET /P "ip=computer's ip=" | |
FOR /F "tokens=*" %%D IN ('mysql -uroot -p"password" -h%ip% -N database -e "select table_name from information_schema.columns where table_schema='database' and data_type like '%%char%%' and character_set_name not like '%%latin1%%' group by table_name"') do mysql -uroot -p"password" -h%ip% database -P 3306 -e "alter table %%D convert to character set latin1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment