Things You Will Need
- A USB flash drive, at least 8 GB https://amzn.to/3wkR5ju | https://amzn.to/3qkrJ1p | https://amzn.to/3Nhu9b9
- Download MySQL Workbench Download
- Download the latest MySQL binary .zip Download
- Extract the downloaded .zip file
- Rename the extracted folder MySQL
- Cut the MySQL folder to the USB flash drive
- Navigate back to the folder with the MySQL Workbench .msi
- While holding Shift, right click in the whitespace > Open PowerShell window here
- 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:\
exit - Navigate to the USB flash drive and create a new text file called MySQL.bat
- Paste the following contents into the .bat file
"%~dp0MySQL\bin\mysqld.exe" --standalone
- Save MySQL.bat
- Navigate into \MySQL\bin on the USB flash drive
- While holding Shift, right click in the whitespace > Open PowerShell window here
- Run the following command to initialize the MySQL server
.\mysqld --initialize
exit - Find the .err file in the \MySQL\data directory and open it in a text editor
- Search for the phrase temporary password > Copy the randomly generated password for the root account to the clipboard
- Right click MySQL.bat on the root of the USB flash drive > Run as Administrator
- The MySQL server process is now running
- Navigate into \MySQL\MySQL Workbench 8.0 CE\ on the USB flash drive and launch MySQLWorkbench.exe
- Click the Plus icon next to MySQL Connections
- Enter a connection name (ie Portable MySQL) > Click OK
- Double click the new connection
- Paste the password found in the .err file
- Enter and confirm a new root password
- The connection should be successful, click OK
- 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