Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to connect to MariaDB/MySQL and open the Plesk psa database?
Answer
Note: This guide is intended for Plesk administrators with SSH / RDP access to the server.
-
To access Plesk database in MariaDB/MySQL:
[root@server]# plesk db
Once you are logged in, start running SQL queries.
Example of an SQL query:
MYSQL_LIN: mysql> select id,name from domains where name='example.com';
+----+-------------+
| id | name |
+----+-------------+
| 3 | example.com |
+----+-------------+To exit MySQL/MariaDB, run the command:
MYSQL_LIN: mysql> quit
-
To run a query to Plesk database without logging in to MariaDB/MySQL:
[root@server]# plesk db "your_query_here"
Example:
[root@server]# plesk db "select id,name from domains where name='example.com'"
+----+-------------+
| id | name |
+----+-------------+
| 3 | example.com |
+----+-------------+
On Windows Server, Plesk uses two MariaDB/MySQL instances:
- Plesk SQL Server on port 8306: for Plesk databases psa and apsc
- MariaDB/MySQL server on port 3306: for customers' databases
Accessing Plesk SQL Server
- Use the
plesk dbutility:-
To access Plesk database in MySQL:
C:\> plesk db
Once you are logged in, start running SQL queries.
Example of an SQL query:
C:\> mysql> select id,name from domains where name='example.com';
+----+-------------+
| id | name |
+----+-------------+
| 3 | example.com |
+----+-------------+To exit MySQL, run the command:
C:\> mysql> quit
-
To run a query to Plesk database without logging in to MySQL:
C:\> plesk db "your_query_here"
Example:
C:\> plesk db "select id,name from domains where name='example.com'"
+----+-------------+
| id | name |
+----+-------------+
| 3 | example.com |
+----+-------------+
-
Accessing MariaDB/MySQL server
-
Run the following command:
C:\> "%plesk_dir%\MySQL\bin\mysql" -P3306 -uadmin -p
If the password is unknown, reset it according to this KB article.
Comments
Please sign in to leave a comment.