Documentation

Databases

4 min read Updated From the StackRegent manual

Your subscription can have MariaDB (MySQL-compatible) and Microsoft SQL Server databases, as far as its plan allows. Open Databases from Home or the subscription page. The page has three tabs: Databases, Users and ODBC Data Sources.

Create a database#

  1. On the Databases tab, click Add database.
  2. Choose the Type: MariaDB or SQL Server (only types available on the server are shown).
  3. If there is more than one server of that type and the plan lets you choose, pick the Server.
  4. Enter the Database name: letters, digits and underscores. The server may add a prefix such as the system user name.
  5. Optionally choose a Related website. It is for your overview only.
  6. Leave Create a database user ticked and enter the User name and Password. Applications use these in their connection string.
  7. Choose the Access: Read and write, Read only or Write only. Tick Access to every … database of the subscription to give the user all databases of that type.
  8. Click Create.

The toolbar shows how many MariaDB and SQL Server databases you have and how many the plan allows. Refresh sizes updates the Size column.

Database users#

The Users tab lists every database user with server, database, access and remote access.

  1. Click Add database user.
  2. Enter User name and Password (at least 8 characters).
  3. Choose the Database: one database, or all databases of a type on a server.
  4. Choose the Access.
  5. For MariaDB, choose Remote access: Server default, This server only, Any host or These hosts (for example 203.0.113.5, 192.168.1.%). Local connections from this server always work.
  6. Click Create.

Use Change to set a new password or access, and the bin icon to remove a user.

phpMyAdmin#

For MariaDB databases, click phpMyAdmin in the database's row. phpMyAdmin opens in a new tab, already signed in as the database user, so you do not type a password. The button needs at least one user on the database ("Add a user first") and phpMyAdmin installed on the server.

SQL console#

Click SQL (MariaDB) or Web Admin (SQL Server) in the database's row.

  • The Tables list on the left shows the tables; click one to see its first rows.
  • Type a statement in the editor and click Run, or press Ctrl+S. One statement runs at a time.
  • Results show up to 1000 rows. For statements without results, the panel says how many rows were affected.

Statements run with the rights of the database user named at the top.

More actions#

The menu button at the end of a database's row offers:

ActionMariaDBSQL Server
ExportExport dumpBack up to the webspace
ImportImport dumpRestore from a backup
Checkyesyes
Repair tablesyesno
CopyCreates a new database with all tables and data; users are not copiedsame
RemoveDeletes the databasesame

Exports land in /private/db_dumps of the webspace. To import, choose a Saved dump, or enter a File in the webspace: a .sql dump or SQL Server .bak file, or a .zip holding one. Upload it with File Manager first. Restoring a SQL Server backup replaces the whole database.

Connect from your application#

The website's Connection Info tool (open the website with Manage) lists the database server addresses of the subscription, for example localhost:3306 for MariaDB. Use the database name, user name and password you created.

PHP (MariaDB)#

$db = new PDO('mysql:host=localhost;port=3306;dbname=shop_db;charset=utf8mb4', 'shop_user', 'password');

ASP.NET (SQL Server)#

Use the SQL Server address shown under Connection Info. Store the connection string in the website's ASP.NET Settings:

  1. Open the website and click ASP.NET Settings.
  2. Tick Manage these settings in the website's web.config.
  3. Under Connection strings, add one per line as name=connection string, for example:
ShopDb=Server=<server from Connection Info>;Database=shop_db;User Id=shop_user;Password=password;
  1. Click Save. Your code reads it by name, for example ConfigurationManager.ConnectionStrings["ShopDb"].

Remote connections from your own computer need the database user's remote access set, and the server's firewall must allow the port. Ask your provider if you are not sure.

SQL Server Management Studio#

  1. In Connect to Server, enter the SQL Server address from Connection Info as the Server name (add ,1433 if the port is not found).
  2. Choose SQL Server Authentication and enter the database user's Login and Password.
  3. If the server hides other customers' databases, Object Explorer lists only the databases your user owns: the first read-write user of each database. Any other user of a database clicks Options, opens Connection Properties and types the database name in Connect to database.

ODBC data sources#

If the plan includes ODBC, the ODBC Data Sources tab lets you Add data source with a Name, Driver, Settings (driver keywords such as Server and Database) and a Description. Passwords are not stored in data sources. Test checks the connection. Applications connect with DSN=<name> in their connection string.

Troubleshooting#

ProblemSolution
Add database is greyed outNo database server is available to the subscription; ask your provider
"Your hosting plan does not allow this."The plan does not include Databases management
"No user" in the Users columnAdd a database user before using the database
Access denied from your computerSet Remote access for the MariaDB user
  • Websites and domains
  • Backups and scheduled tasks
Was this article helpful?

Something missing? Ask in the community or open a ticket.