iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
The dependable pattern is straightforward: run MariaDB on the VPS, create a database and a separate least-privilege application account, install MariaDB Connector/Python inside your virtual environment, and use parameterized SQL with explicit transactions. For an application running on the same VPS, prefer the local Unix socket or loopback instead of exposing port 3306 to the internet. Back up with mariadb-dump or mariadb-backup, keep copies away from the VPS, and test a restore before you need one.
This guide shows the complete workflow, including schema creation, Python CRUD code, connection choices, remote-access controls, backup commands, and the failure modes most often encountered on a self-managed Linux server.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallWhat you are building
MariaDB stores the durable data; Python sends SQL statements through MariaDB Connector/Python. The connector is MariaDB’s official Python client and implements Python DB API 2.0 (PEP 249), so familiar objects such as connections, cursors, parameterized statements, commits, rollbacks, and fetch methods apply.
A typical deployment has four layers:
- MariaDB Server: installed and managed by the Linux distribution’s supported packages or MariaDB’s repository instructions.
- Database and schema: tables, keys, constraints, and indexes designed for your application.
- Application account: a user that can access only the required database and operations.
- Python process: a virtual-environment installation of the
mariadbpackage, using a local socket or controlled TCP connection.
The examples use a small notes table. Adapt the columns and constraints to your domain rather than treating this schema as a universal model.
#1 Best Overall
- Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
- With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
- Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
- Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
- Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
Prerequisites on the Linux VPS
Install and enable MariaDB
Use the package and service procedure supported by your distribution. Package names and repository versions differ between Debian-based and Red Hat-based systems, so check the current MariaDB server documentation and your distribution’s release notes before production deployment. After installation, enable the service at boot and confirm that it is running with your system’s service manager.
Run the initial hardening procedure supplied with your installation. Remove anonymous accounts and test databases if the procedure offers those choices, and set an administrative credential that is not reused by the application.
Create a database and application account
Connect as an administrator through the local socket and create a database with an explicit character set. Then create an account whose host part matches where the application runs. A local-only account is preferable for a same-VPS process:
CREATE DATABASE app_db
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE USER 'app_user'@'localhost' IDENTIFIED BY 'use-a-long-random-secret';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX
ON app_db.* TO 'app_user'@'localhost';
FLUSH PRIVILEGES;
Grant only what the running application needs. A migration process may require CREATE, ALTER, or INDEX, while a production runtime account often needs only data manipulation privileges. Keep schema-changing credentials separate when practical, and never put the root account’s password in application code.
Install the Python connector in an isolated environment
Create a virtual environment for the service and install the official package:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install mariadb
Pin a connector release that your project has tested. Connector defaults, supported parameter styles, and binary/prepared-protocol behavior can vary by major version, so verify the installed release’s API documentation during deployment rather than assuming an example from another version still applies.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
- Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
- Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
- Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
- Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
Choose the right connection path
The network path is a security decision, not merely a syntax choice.
| Situation | Preferred path | What to configure | Main trade-off |
|---|---|---|---|
| Python and MariaDB on the same VPS | Unix socket, or loopback TCP | Use the detected socket path or 127.0.0.1/localhost; leave public listening disabled when possible |
Lowest exposure; local processes must be managed on the server |
| Administration from another machine | SSH tunnel or private network | Keep MariaDB private and authenticate through the tunnel or private interface | More setup, but avoids opening a public database port |
| Separate application server | Private TCP interface | Bind only to the required address, restrict the account by source host, allow port 3306 only from that source, and configure TLS as appropriate | Requires coordinated firewall, grants, and certificate settings |
| Public-internet database access | Avoid unless there is no safer architecture | Strict source allow-listing, TLS, monitoring, and hardened credentials are mandatory | Largest attack surface and ongoing maintenance burden |
MariaDB’s remote-access settings are controlled by skip-networking and bind-address. skip-networking disables TCP/IP listening; bind-address limits which local address accepts TCP connections. Even when MariaDB listens, a VPS firewall can block incoming traffic to the default port, 3306. Treat the database firewall rule and the MariaDB listener as separate controls.
Connect from Python safely
Keyword arguments and a local connection
The connector accepts keyword arguments for host, credentials, database, port, timeouts, and Unix sockets. For a same-host service, begin with a local socket or loopback:
import mariadb
conn = mariadb.connect(
host="localhost",
user="app_user",
password="use-a-secret-store",
database="app_db",
# port=3306, # needed for TCP when not using the default
# unix_socket="/run/mysqld/mysqld.sock", # set when autodetection is unsuitable
# connect_timeout=5,
)
On Linux, the connector can autodetect a distribution-specific socket when localhost is used. If your distribution stores the socket elsewhere, specify its full path or use 127.0.0.1 to force loopback TCP. Do not put a password in source control; inject it through a protected environment, secret manager, or service credential file with restrictive permissions.
Free tools Windows power users keep installed
One-click scans. No signup required.
URI form and version checks
A URI-style connection is also available, but keyword arguments make individual settings easier to review:
conn = mariadb.connect(
"mariadb://app_user:password@localhost:3306/app_db"
)
URI escaping rules and optional protocol flags are version-sensitive. Confirm the exact syntax, placeholder style, timeout names, and prepared/binary protocol options in the Connector/Python documentation shipped with the version you install.
Rank #3
- 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
- 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
- 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
- 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
- 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
Design a table before writing application code
Define types and constraints explicitly. A primary key gives every row a stable identity, while an index on a frequent filter avoids scanning the entire table as data grows:
CREATE TABLE notes (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
body TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
INDEX ix_notes_created_at (created_at)
) ENGINE=InnoDB;
InnoDB is the normal choice for transactional application data. Choose lengths and numeric ranges from the domain you actually need. Add NOT NULL, unique constraints, and foreign keys where they represent business rules; preventing invalid states in the database protects every client, not only the current Python code.
Insert, retrieve, update, and delete rows
Values must be passed separately from SQL text. Parameterization prevents user input from becoming executable SQL and lets the connector handle quoting and type conversion.
A complete CRUD example
import mariadb
def open_connection():
return mariadb.connect(
host="localhost",
user="app_user",
password="use-a-secret-store",
database="app_db",
)
def create_note(body: str) -> int:
conn = open_connection()
cur = conn.cursor()
try:
cur.execute(
"INSERT INTO notes (body) VALUES (?)",
(body,),
)
conn.commit()
return cur.lastrowid
except mariadb.Error:
conn.rollback()
raise
finally:
cur.close()
conn.close()
def get_note(note_id: int):
conn = open_connection()
cur = conn.cursor()
try:
cur.execute(
"SELECT id, body, created_at, updated_at "
"FROM notes WHERE id = ?",
(note_id,),
)
return cur.fetchone()
finally:
cur.close()
conn.close()
def update_note(note_id: int, body: str) -> None:
conn = open_connection()
cur = conn.cursor()
try:
cur.execute(
"UPDATE notes SET body = ? WHERE id = ?",
(body, note_id),
)
conn.commit()
except mariadb.Error:
conn.rollback()
raise
finally:
cur.close()
conn.close()
def delete_note(note_id: int) -> None:
conn = open_connection()
cur = conn.cursor()
try:
cur.execute("DELETE FROM notes WHERE id = ?", (note_id,))
conn.commit()
except mariadb.Error:
conn.rollback()
raise
finally:
cur.close()
conn.close()
The single-item tuple syntax matters: (note_id,) is a tuple, while (note_id) is just a parenthesized value. The example uses question-mark placeholders, a commonly supported Connector/Python style; confirm the accepted parameter style for your installed major version.
Read one row or many rows
fetchone() returns the next row or None when no row matches. Use fetchall() only when the result is known to be small; for larger results, iterate over the cursor or fetch in batches so a single request does not consume all available memory.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →cur.execute(
"SELECT id, body FROM notes "
"WHERE created_at >= ? ORDER BY created_at DESC LIMIT ?",
(since_timestamp, page_size),
)
for row in cur:
note_id, body = row
process(note_id, body)
Never concatenate a user-supplied sort direction, column name, or SQL fragment into a statement. Values can be parameters; identifiers must come from a fixed allow-list in your code.
Rank #4
- 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
- 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
- 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
- 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
Transactions, errors, and connection lifetime
Writes are not durable until committed. Group statements that must succeed together in one transaction, call commit() after all have succeeded, and call rollback() in the exception path. A rollback releases uncommitted changes; it does not undo a transaction that was already committed.
conn = open_connection()
cur = conn.cursor()
try:
cur.execute("INSERT INTO notes (body) VALUES (?)", (first_body,))
first_id = cur.lastrowid
cur.execute("INSERT INTO notes (body) VALUES (?)", (second_body,))
conn.commit()
except mariadb.Error:
conn.rollback()
raise
finally:
cur.close()
conn.close()
Close cursors and connections in a finally block or an equivalent context-managed lifecycle. For a web service, opening a new connection for every request is simple but can become expensive under concurrency. A bounded connection pool can reduce handshake overhead, provided the pool size matches MariaDB’s connection limits and the VPS’s memory and CPU. Return connections to the pool promptly, and reset transaction state before reuse.
Expose MariaDB to another machine only when necessary
Server-side controls
- Set
bind-addressto the specific private interface required by the application, or keepskip-networkingenabled when every client is local. - Create a host-qualified account such as
'app_user'@'10.0.2.15', not a wildcard account that accepts connections from everywhere. - Grant access only to the required schema and operations.
- Permit TCP port 3306 in the VPS firewall only from the application’s source address or private subnet.
- Configure TLS on both server and connector versions when traffic leaves the trusted host or private network, and validate certificates rather than disabling verification.
- Reload or restart MariaDB according to the changed setting, then test from the actual application host.
Do not expose a root account for remote use. If an administrator needs access, use an SSH tunnel or a separate, tightly controlled administrative path.
SSH tunnel alternative
An SSH tunnel keeps MariaDB bound to the VPS while forwarding a local port on an administrator’s workstation:
ssh -N -L 13306:127.0.0.1:3306 admin@your-vps
A local client can then connect to 127.0.0.1:13306. Protect the SSH account with keys, disable password login where appropriate, and close the tunnel when finished. The application itself should generally use a private socket or network rather than relying on a developer’s tunnel.
Back up MariaDB and prove that recovery works
Use a logical dump when you need a portable SQL representation and a physical backup when you need a faster, engine-aware copy of a larger InnoDB installation.
Best Value
- 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
- 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
- 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
- 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
| Utility | Backup type | Useful for | Recovery consideration |
|---|---|---|---|
mariadb-dump |
Logical SQL export | Small or moderate databases, migrations, portability, inspecting individual objects | Restore replays SQL and can take substantial time for large datasets |
mariadb-backup |
Physical backup | InnoDB installations where restore speed and filesystem-level copies matter | Requires the prepare/restore workflow and compatible server conditions |
Logical dump and restore
Run the dump with an account allowed to read the database and write the destination file. Avoid putting the password directly in shell history; use a protected option file or an interactive prompt:
mariadb-dump --user=backup_user --password
--single-transaction --routines --events app_db
> /srv/backups/app_db-$(date +%F).sql
--single-transaction is commonly suitable for InnoDB tables because it creates a consistent snapshot without locking normal reads and writes. Review options for non-InnoDB tables, triggers, routines, events, and users in your own schema. Restore into a prepared database:
mariadb --user=restore_user --password app_db
< /srv/backups/app_db-2026-10-15.sql
Use a temporary database or staging VPS for restore tests so a mistake cannot overwrite production data.
Physical backup
mariadb-backup copies the server’s physical files and is designed for engines including InnoDB. A typical workflow is to create a backup target, run the backup, prepare it, and then use the documented restore or copy-back procedure during a controlled outage. Exact flags, required privileges, and compatibility rules depend on the installed MariaDB release; follow the version-matched utility documentation.
Keep copies off the VPS
A backup stored only on the same disk is not protection against disk failure, VPS deletion, or account compromise. Encrypt files before transfer when your storage service does not provide suitable encryption, restrict access to the backup identity, and retain multiple restore points according to the application’s recovery-point and recovery-time objectives. Schedule the job, alert on failures, and periodically perform a complete restore rather than merely checking that a file exists.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Operational practices for a production VPS
- Configuration: pin tested MariaDB and connector versions, but plan security updates and verify behavior after upgrades.
- Secrets: keep database passwords out of repositories, logs, command histories, and error messages.
- Least privilege: separate runtime, migration, backup, and administrative accounts.
- Resource limits: set connection-pool limits below MariaDB’s configured maximum and leave memory for the operating system and application.
- Observability: monitor service health, disk space, failed connections, slow queries, backup duration, and backup size.
- Durability: use explicit commits and verify that the filesystem and VPS storage have enough free space for binary logs, temporary tables, and backups.
- Change control: test schema migrations and connector upgrades against a restored copy before applying them to production.
Troubleshoot the common failures
| Symptom | Likely cause | Checks and fixes |
|---|---|---|
| “Can’t connect to local server” | MariaDB is stopped, the socket path is wrong, or the client is using the wrong host mode | Check service status, inspect the server’s socket setting, try the explicit socket path, or use 127.0.0.1 for loopback TCP. |
| Connection times out from another host | Listener, route, or firewall blocks the connection | Verify bind-address, confirm MariaDB is listening on the intended interface, and allow port 3306 only from the expected source. |
| “Access denied” | Password mismatch or host-qualified grant does not match the client’s source address | Inspect the exact 'user'@'host' account, reset the secret through an administrative session, and avoid creating a broad wildcard grant as a quick fix. |
| Insert appears successful but disappears | The transaction was never committed or a later exception caused rollback | Call commit() after successful writes and log the exception path without exposing credentials. |
| “You have an error in your SQL syntax” near a placeholder | Parameter style does not match the installed connector version | Check the installed Connector/Python documentation and use its supported placeholder syntax; keep the values in a separate tuple. |
| Restore fails or is incomplete | Incompatible dump options, missing routines/events, permissions, or an unprepared physical backup | Read the restore output, verify object options and privileges, prepare physical backups as documented, and rehearse on a clean server. |
Deployment checklist
- Install MariaDB from a supported repository and enable the service.
- Create the application database with the required character set and collation.
- Create a dedicated account with only runtime privileges; keep migration and backup credentials separate.
- Install and pin a tested
mariadbconnector release in the Python virtual environment. - Connect through a Unix socket or loopback when the process is on the same VPS.
- Use placeholders for every value, explicit commits for writes, and rollbacks for exceptions.
- Close cursors and connections, or return pooled connections promptly.
- If remote TCP is unavoidable, restrict the bind address, host grant, firewall source, and TLS settings.
- Schedule logical or physical backups, copy them off the VPS, protect them, and test restoration.
- Recheck current MariaDB and connector documentation before production rollout because package versions, defaults, and command options change.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

