Skip to content

Portable MySQL Server

Since many PHP projects use MySQL (MariaDB) as their database software, ExeOutput for PHP provides the ability to include a portable MySQL server (MariaDB) with your compiled PHP application. The MySQL server is considered portable because it doesn't need to be installed as a Windows service to function. This behavior is similar to what you find in "WAMP" distributions, except that we don't use Apache or PHP software because they are replaced by ExeOutput for PHP.

Tip

Watch our video tutorial on configuring, using, and distributing the portable MySQL server with your app.

ExeOutput for PHP uses a portable MySQL server provided by the open-source MariaDB project.

Warning

ExeOutput for PHP's main distribution does not include the portable MariaDB server. Use the Web Update utility to download and install the package. Simply click the "Check for updates" icon in ExeOutput for PHP to launch the Web Update utility. Then select "MySQL package for ExeOutput for PHP," and the package will be automatically installed for you.

Once the MySQL package for ExeOutput for PHP is installed, files used for each project are stored in the MySQL\Source\mysql subfolder of ExeOutput for PHP's main installation directory. You can update them manually if desired.

Prepare and Configure the MySQL Portable Server

First, you must define the folder where your application EXE file will be created (Output Path). All files required by the MySQL portable server will be copied into a "MySQL" subfolder.

Note

This subfolder must always be placed in the same directory as the application EXE output file. Therefore, you must include this entire folder when distributing your application or create an installer with Paquet Builder, for instance.

When you click this button, you will be prompted for two settings: the root password and the connection port (the TCP/IP port number to use for the connection. The default is 3306).

All files required by the MySQL portable server are then copied to the "MySQL" subfolder, and the server is started. ExeOutput for PHP will prompt you to click OK once the server is ready and listening.

Finally, ExeOutput for PHP shuts down the server. The server is now ready for use with your application.

Warning

Do not change the root password manually. ExeOutput for PHP retains the root password to shut down the server when the application closes. If you need to change it, repeat the steps above.

If you want to remember the root password and connection port you used, click the appropriate links in ExeOutput for PHP labeled Show Configured Username and Password and Show Configured Port.

Create Databases and Manage Them with Adminer

The MySQL server provided is a vanilla distribution. Except for the root password, no other settings are modified: you must configure settings yourself (thanks to the my.ini configuration file in the "mysql" subfolder).

To manage the databases of the portable MySQL server, use a MySQL client. Some MySQL clients are available in PHP, such as phpMyAdmin or Adminer.

We have compiled Adminer with ExeOutput for PHP into Adminer EXE, allowing you to run Adminer EXE without requiring any local PHP installation or WAMP distribution. Furthermore, to help you administer your portable MySQL server, ExeOutput for PHP can place a temporary copy of Adminer EXE in the same folder as your output EXE file and run it. This way, Adminer will automatically start the portable MySQL server of your PHP application, enabling you to execute SQL commands, manage databases, and more. When you close Adminer EXE, the portable MySQL server is also shut down.

When Adminer EXE Starts, Enter Your Credentials:

When Adminer EXE is started, enter your credentials:

Info

If you changed the connection port, enter localhost:[newport] in the server field.

The username is root by default, and the password is the root password you defined in the previous step.

Then Choose to Create a New Database, Execute SQL Commands, Import Data...

Then choose to create a new database, execute SQL commands, import data...

Before distributing your PHP application, remove the Adminer EXE tool from the folder or exclude it.

Warning

ExeOutput for PHP's main distribution does not include the Adminer EXE tool. You must download and install the package yourself using the Web Update utility. Click the "Check for updates" icon in ExeOutput for PHP to launch the Web Update utility. Then select "Adminer package for ExeOutput for PHP," and the package will be automatically installed for you.

Associate Your PHP Application with the MySQL Portable Server

First, enable the MySQLi PHP extension so your PHP application can interact with MySQL. To do this, go to the "PHP Settings -> PHP Extensions" page in ExeOutput for PHP. Then, configure your application to automatically start the MySQL server when it runs and stop it when the application exits by selecting Start and stop the MySQL server automatically.

Info

It may take some time before the MySQL server is ready to communicate with your application.

If your application needs to communicate immediately with the data server upon startup, you may encounter a connection error. To mitigate this, you can add a few extra seconds of delay using the Delay to wait for the server to start (in seconds) option.

If the server cannot be started for any reason, an error will be displayed at startup. You can customize the error message using the Localization tab.

Only one instance of the server can run at a time. We recommend that you enforce this with your application as well. Go to Security / Global Options and select Only one instance of the application can be run at a time.

Warning

The PHP application always expects to find the portable server in the "MySQL" subfolder of the application EXE's location.

Remove the MySQL Server from Your Application

To remove the portable MySQL server, deselect Start and stop the MySQL server automatically, and then you can delete the "MySQL" subfolder from the application EXE's location. That's all you need to do.

How to Detect MySQL Server Errors

The MySQL server logs extensive information, including any errors that may occur during its execution. To view this log, click on the link titled "Open server log" in ExeOutput for PHP.

ExeOutput's MySQL Demo Sample

To demonstrate that ExeOutput for PHP can work with MySQL-based applications, we successfully compiled the popular WordPress app into a portable desktop application. The sample includes full source code and a tutorial! Feel free to check it out.

Using Databases in Applications


This revised documentation maintains the original technical content while enhancing clarity, grammar, and readability to ensure it aligns with native English documentation standards. All Markdown and MkDocs syntaxes, including admonitions and links, have been preserved and refined as needed.