Guide to Resetting Database Passwords in ServBay
When developing web applications using the ServBay local development environment, managing databases such as MySQL, MariaDB, PostgreSQL, and Redis is one of the core tasks. Occasionally, for security purposes, forgotten credentials, or other reasons, you may need to reset database user passwords. This article provides a detailed, secure, and efficient guide to resetting passwords for these popular databases in ServBay, covering both graphical and command-line methods.
Please note: the configuration and paths for different versions of database packages in ServBay may vary slightly. Always refer to the actual version you are using when performing these operations.
Resetting MySQL/MariaDB root Password
TIP
Resetting the root user password for MySQL and MariaDB databases involves essentially the same steps. This section uses MariaDB as an example.
MySQL and MariaDB are widely used relational database management systems and form important components of ServBay. This section will provide a step-by-step guide on how to reset the root password for MySQL and MariaDB within ServBay.
The demonstration below uses the integrated MariaDB 11.3 version from ServBay as an example.
Method 1: Reset MariaDB root Password via ServBay GUI
ServBay offers a user-friendly graphical interface to quickly reset the root password for your databases.
- Launch the ServBay application.
- Expand the
Databasessection in the left sidebar, selectMariaDB, then pick the specific version you want to reset the password for (e.g.,MariaDB 11.3). - On the details page for the selected package (on the right), locate the
Passwordinput field. - Click the lock icon next to the
Passwordfield. - A prompt will appear to confirm resetting the
rootpassword. ClickConfirm. - The
rootpassword will be reset to ServBay’s default:ServBay.dev.

Method 2: Reset MariaDB root Password from the Command Line
For more advanced users, or cases when you need to automate the process, the MariaDB root password can also be reset via the command line. This method usually involves launching the database in a mode that skips privilege checks.
The steps below use MariaDB 11.3 as an example; please adjust paths and version numbers to match your installation.
Stop the MariaDB Service: Use ServBay’s control tool to stop the MariaDB service.
bashservbayctl stop mariadb 11.31Replace
mariadb 11.3with the correct version identifier for your MariaDB instance.Start MariaDB in Safe Mode: Launch MariaDB with grant tables and networking disabled to bypass authentication.
bash/Applications/ServBay/package/mariadb/11.3/current/bin/mysqld_safe --skip-grant-tables --skip-networking &1/Applications/ServBay/package/mariadb/11.3/current/bin/mysqld_safeis the MariaDB executable path within ServBay.--skip-grant-tablesallows login without a password and full privileges;--skip-networkingprevents remote connections for safety. The&runs the process in the background.Log in to MariaDB: Use the
mysqlclient to log in asroot—no password is required in safe mode.bash/Applications/ServBay/package/mariadb/11.3/current/bin/mysql -u root1The given path points to the MariaDB client executable.
Reset the Password: Inside the MariaDB prompt, update the root password using SQL commands.
sqlFLUSH PRIVILEGES; -- Refresh privileges to ensure ALTER USER takes effect ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; -- Replace 'new_password' with your new password FLUSH PRIVILEGES; -- Refresh again after changes1
2
3Replace
'new_password'with a strong password of your choice. Do not use the defaultServBay.devunless strictly for temporary use.Exit MariaDB: After resetting the password, exit the
mysqlclient.sqlexit;1Stop the Safe Mode MariaDB Process: Stop the safe-mode MariaDB instance. Preferably, use
servbayctl stop, or manually kill themysqld_safebackground process if necessary.bashservbayctl stop mariadb 11.31If
servbayctl stopdoesn’t work for the safe-mode process (started withmysqld_safe &), useps aux | grep mysqld_safeto find the process ID, then terminate it withkill <PID>.Restart MariaDB Service: Start MariaDB again in normal mode. The new password is now active.
bashservbayctl start mariadb 11.31
Resetting PostgreSQL Passwords
PostgreSQL is a robust, highly popular open-source object-relational database system. The steps below explain how to reset user passwords for PostgreSQL in ServBay, typically for the default admin user created by ServBay.
The example will use the integrated PostgreSQL 16 from ServBay.
PostgreSQL Password Reset Workflow
Resetting a PostgreSQL password typically requires temporarily modifying its authentication config file pg_hba.conf to allow passwordless local connections, then executing SQL to set a new password.
Locate the PostgreSQL Admin Account: Determine which PostgreSQL username you need to reset. You can find this user in ServBay’s GUI:
Open ServBay’s control panel, navigate toDatabases→PostgreSQL, select your version (e.g.,PostgreSQL 16). On the right details panel, note the administrator’s username in theAccountsection—usually something likeservbay.
Stop PostgreSQL Service: Stop the PostgreSQL service using ServBay’s control command.
bashservbayctl stop postgresql 161Replace
postgresql 16with your actual PostgreSQL version identifier.Backup
pg_hba.conf: Thepg_hba.conffile controls PostgreSQL client authentication. Always back it up before editing.bashcp /Applications/ServBay/db/postgresql/16/pg_hba.conf /Applications/ServBay/db/postgresql/16/pg_hba.conf.bak1Adjust the path according to your ServBay installation and PostgreSQL version.
Edit
pg_hba.confto Temporarily Allow Trust Authentication: Edit the file and change local authentication from password-based (likescram-sha-256ormd5) totrust, so you can connect without a password.bashsed -i '' 's/scram-sha-256/trust/g' /Applications/ServBay/db/postgresql/16/pg_hba.conf1This
sedcommand (for macOS) replaces allscram-sha-256references withtrustin the config file. If your file usesmd5or another method, adjust the replacement target (e.g.,s/md5/trust/g). The-i ''flag edits the file in place.Start PostgreSQL: Restart the service for the config change to take effect.
bashservbayctl start postgresql 161Access the
psqlCommand-Line: Use thepsqlclient to connect to PostgreSQL. With trust authentication enabled, you won’t need a password.bashpsql -h /Applications/ServBay/tmp -U <username from step 1> postgres # Example: psql -h /Applications/ServBay/tmp -U servbay postgres1
2Substitute
<username from step 1>with the actual admin username. The-h /Applications/ServBay/tmpconnects via the ServBay-created Unix socket;-U <user>specifies the user, andpostgresis the default database.Reset the Password: At the
psqlprompt, set a new password for the user.sqlALTER USER <username from step 1> WITH PASSWORD 'new_password'; -- Example: ALTER USER servbay WITH PASSWORD 'new_password';1
2Replace
<username from step 1>with your account’s actual username, and'new_password'with a strong password.Exit
psql: When finished, quit thepsqlshell.sql\q1Stop PostgreSQL Service: Stop the service so you can restore the original authentication config.
bashservbayctl stop postgresql 161Restore the Original
pg_hba.conf: Copy back the backup file to restore password authentication for security.bashcp /Applications/ServBay/db/postgresql/16/pg_hba.conf.bak /Applications/ServBay/db/postgresql/16/pg_hba.conf1Restart PostgreSQL Service: Start PostgreSQL again in password authentication mode.
bashservbayctl start postgresql 161You can now connect using your newly set password.
Resetting Redis Password
Redis is a high-performance open-source in-memory data store, often used for databases, caching, and messaging. Here’s how to reset the Redis password in ServBay.
Method 1: Reset Redis Password via the ServBay GUI
ServBay provides an intuitive way to manage Redis passwords through its interface.
- Open the ServBay application.
- In the left sidebar, expand
Databases, selectNoSQL, and then selectRedis. - On the Redis details page (right side), find the
Passwordinput field. - Enter your new desired password in the field. (If no password was set before, the field may be blank.)
- Click the
Savebutton next to the field. - ServBay will automatically restart Redis to apply your new settings.

Method 2: Edit redis.conf Directly to Reset Redis Password
You can also reset the Redis password by modifying the redis.conf configuration file.
Open the Redis Config File: Use a text editor to open the Redis config file in ServBay. It is usually found in ServBay’s config directory.
bashvim /Applications/ServBay/package/etc/redis/redis.conf1You can use
vim,nano, or your preferred editor. Modify the path as needed to match your installation.Find and Edit the
requirepassDirective: Inredis.conf, look for the line that starts withrequirepass. If it is commented out with a#, remove the#. Change the value to your desired new password.plaintextrequirepass your_new_strong_password1Replace
your_new_strong_passwordwith a strong password of your choice.Save and Exit the Editor: Save your changes to the
redis.conffile.Restart Redis Service: Use ServBay’s control tool to restart Redis so your changes take effect.
bashservbayctl restart redis -all1The
restart redis -allcommand restarts all Redis instances managed by ServBay.
Summary
Resetting database passwords is a vital aspect of database management. With this comprehensive guide, you now understand how to reset passwords for MySQL/MariaDB, PostgreSQL, and Redis in the ServBay local development environment. Whether you choose the ServBay GUI or the command-line approach, following these steps will help you quickly regain access after a forgotten password or enhance your system’s security. Always store your new passwords securely and use strong, unique passwords to keep your local development environment and data protected.
