Portable MySQL USB Flash Install Guide 🌱

Things You Will Need

  1. Download MySQL Workbench Download
  2. Download the latest MySQL binary .zip Download
  3. Extract the downloaded .zip file
  4. Rename the extracted folder MySQL
  5. Cut the MySQL folder to the USB flash drive
  6. Navigate back to the folder with the MySQL Workbench .msi
  7. While holding Shift, right click in the whitespace > Open PowerShell window here
  8. Run the following command in PowerShell to extract the .msi to the USB flash drive, update the drive letter as needed
    msiexec /a mysql-workbench-community-8.0.25-winx64.msi /qb TARGETDIR=H:\
  9. Navigate to the USB flash drive and create a new text file called MySQL.bat
  10. Paste the following contents into the .bat file

    "%~dp0MySQL\bin\mysqld.exe" --standalone

  11. Save MySQL.bat
  12. Navigate into \MySQL\bin on the USB flash drive
  13. While holding Shift, right click in the whitespace > Open PowerShell window here
  14. Run the following command to initialize the MySQL server
    .\mysqld --initialize
  15. Find the .err file in the \MySQL\data directory and open it in a text editor
  16. Search for the phrase temporary password > Copy the randomly generated password for the root account to the clipboard
  17. Right click MySQL.bat on the root of the USB flash drive > Run as Administrator
  18. The MySQL server process is now running
  19. Navigate into \MySQL\MySQL Workbench 8.0 CE\ on the USB flash drive and launch MySQLWorkbench.exe
  20. Click the Plus icon next to MySQL Connections
  21. Enter a connection name (ie Portable MySQL) > Click OK
  22. Double click the new connection
  23. Paste the password found in the .err file
  24. Enter and confirm a new root password
  25. The connection should be successful, click OK
  26. Welcome to a portable MySQL database instance with GUI

To stop the MySQL instance, simply kill mysqld.exe by pressing CTRL+C in the open command prompt running MySQL.bat

Additional server options for MySQL.bat https://dev.mysql.com/doc/refman/8.0/en/server-options.html