:: Remove all environmental variables that begin with ~ for /f "tokens=1* delims==" %%# in ('set ~') do @set %%#= "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" MySQL RENAME USER 'classicmodels_backup'%' TO 'classicmodels_backup'localhost';