How to Install MyWebSQL on Ubuntu 20.04 – Quick and Reliable Setup
Want a browser‑based MySQL client that won’t give you headaches?
This guide walks through installing MyWebSQL on an empty Ubuntu 20.04 box, from setting up the LAMP stack to getting your first database query running. No fluff, just what you need.
1. Get a Fresh LAMP Stack
sudo apt update sudo apt install apache2 php libapache2-mod-php mysql-server
MyWebSQL is pure PHP; it needs Apache and MySQL to talk to the database layer. Installing the whole stack in one shot saves you from hunting down missing modules later.
2. Install Required PHP Extensions
sudo apt install php-mysql php-xml php-json
The client relies on mysqli for MySQL access and a few other extensions for its UI. Without them the page will break before you even see it.
3. Download MyWebSQL
cd /tmp wget https://github.com/loeffel-systems/MyWebSQL/archive/refs/tags/v2.4.tar.gz tar xzf v2.4.tar.gz sudo mv MyWebSQL-2.4 /var/www/html/mywebsql
Pulling from the GitHub releases page ensures you’re on a stable version. Moving it to /var/www/html makes Apache serve it automatically.
4. Configure the Client
sudo cp /var/www/html/mywebsql/config.php.example /var/www/html/mywebsql/config.php sudo nano /var/www/html/mywebsql/config.php
The example file contains placeholders for your MySQL user and password. Open it, replace root with a dedicated user (see next step) and set the right credentials. Save and exit.
5. Create a Dedicated Database User
sudo mysql -u root -p CREATE USER 'mywebsql'@'localhost' IDENTIFIED BY 'secure_password'; GRANT ALL PRIVILEGES ON . TO 'mywebsql'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
Running MyWebSQL as root is a nightmare for security and can cause accidental schema changes. A dedicated user keeps everything tidy.
6. Give Apache Ownership
sudo chown -R www-data:www-data /var/www/html/mywebsql sudo chmod -R 755 /var/www/html/mywebsql
Apache runs as www-data; it needs read access to the files and write permissions on any upload directories. Setting the ownership correctly prevents “permission denied” errors when you try to import CSVs.
7. Test It
Open a browser to http://your_server_ip/mywebsql.
You should see the login screen. Log in with the user you created (mywebsql / secure_password). If everything is correct, the dashboard will load and let you run queries against any database on that server.
8. (Optional) Harden It Further
sudo ufw allow 'Apache Full' sudo systemctl enable apache2 mysql
Enabling UFW rules keeps only HTTP/HTTPS open, while auto‑starting the services saves you from having to run them after a reboot.
Real‑world note: I once had a colleague whose MyWebSQL installation crashed after an accidental apt upgrade that pulled in a newer PHP version. The fix was simply reinstalling the correct PHP modules and restarting Apache—no biggie, but a good reminder that LAMP stacks can be fragile if you don’t pin your PHP version.
That’s it! You’ve got a lightweight web client up and running on Ubuntu 20.04. Now go query away—or set up a cron job to dump backups in the background.