Table of Contents
By default, MariaDB (and MySQL) only allows local access. If you want to connect remotely—e.g. from your MacBook to a MariaDB server running on Windows via Tailscale—you need to configure a few things.
1. Allow Remote Connections in MariaDB
First, make sure MariaDB is listening to all IP addresses.
- Open the MariaDB config file. On Windows, it's usually found at:
C:\Program Files\MariaDB XX\data\my.ini
Find the line:
bind-address = 127.0.0.1
And change it to:
# bind-address = 127.0.0.1
Or just comment it out entirely (as shown), which allows it to bind to all interfaces.
After editing, restart the MariaDB service.
2. Create or Update a User for Remote Access
Login to MariaDB using the command line:
mysql -u root -p
Then create a user that can connect from any host (or a specific IP):
CREATE USER 'youruser'@'%' IDENTIFIED BY 'yourpassword';
Or, if the user already exists and you just want to update their host:
UPDATE mysql.user SET Host='%' WHERE User='youruser';
Don't forget to apply changes:
FLUSH PRIVILEGES;
3. Change MariaDB User Password
To change a user's password (for example, for root
):
ALTER USER 'root'@'%' IDENTIFIED BY 'new_secure_password';
Again, apply the changes:
FLUSH PRIVILEGES;
4. Test Remote Connection
From your client machine (e.g. MacBook), run:
mysql -h your-server-ip -u youruser -p
If you're using Tailscale, you can replace your-server-ip
with the Tailscale hostname or IP.
Optional: Access via phpMyAdmin
If you’ve installed phpMyAdmin on the server, and it's accessible via Tailscale IP, open it in your browser like this:
http://your-server-name.tailnet.ts.net/phpmyadmin
Security Reminder
- Use strong passwords.
- Restrict host access if possible (e.g.
'user'@'192.168.1.10'
instead of'user'@'%'
). - Regularly update MariaDB and patch vulnerabilities.
That’s it! You’ve now enabled remote access and updated your user password for MariaDB.