• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Forwarded to devs Plesk Migrator does not copy databases from DirectAdmin

peter21581

New Pleskian
Greetings,

Although I'm not a Plesk customer, I'm assisting a friend in transitioning from DirectAdmin to Plesk. While using the Plesk migrator version 2.24.0-1083, I encountered an issue with the database connection code. Despite being unfamiliar with Python coding, I have managed to resolve the problem successfully. Therefore, I kindly request the Plesk development team to implement the necessary modifications to the code accordingly.


Error when migrating from DirectAdmin:
Code:
+|2023-06-21_14:15:58,502|D|MT|core.runners.base|||Execute command on the source server 'directadmin' (103.XXX.XXX.XXX): /opt/plesk/python/2.7/bin/python /root/plesk_migrator/plesk_migrator-umb62pya3ubd1sw60rg8iznzgmlobpfp/agent/main.py
+|2023-06-21_14:15:58,729|D|MT|core.runners.base|||Command execution results:
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||stdout: [2023-06-21 09:15:58] Getting DirectAdmin config
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Connecting DirectAdmin database
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Failed to connect to DirectAdmin database with [login]@[host]:[port] "da_admin@localhost:3306" and password "*****":
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||(1045, u"Access denied for user 'da_admin'@'127.0.0.1' (using password: YES)")
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||Database content will not be dumped
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Determining DirectAdmin database vendor and version
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Connection is not found, breaking
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] -- START DUMP --
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Customer 'giango'
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Subscription 'dietxoxo.com'
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] -- FINISH DUMP --
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Printing warnings
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||Failed to connect to DirectAdmin database with [login]@[host]:[port] "da_admin@localhost:3306" and password "*****":
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||(1045, u"Access denied for user 'da_admin'@'127.0.0.1' (using password: YES)")
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||Database content will not be dumped
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||MIGRATION STATUS:
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||END OF MIGRATION STATUS
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] Writing dump file
=|2023-06-21_14:15:58,729|D|MT|core.runners.base|||[2023-06-21 09:15:58] SUCCESS: 'hosting-description.yaml' is ready

Solution:
Made changes to /usr/local/psa/admin/plib/modules/panel-migrator/backend/lib/python/parallels/plesk/source/directadmin/agent/dumper.py

Line 216
From:
Code:
        try:
            connection = pymysql.connect(
                user=user,
                passwd=passwd,
                host=host,
                port=n_port,
                db="mysql"
            )

To:
Code:
        try:
            if os.path.exists("/var/lib/mysql/mysql.sock"):
                connection = pymysql.connect(
                user=user,
                passwd=passwd,
                unix_socket="/var/lib/mysql/mysql.sock",
                db="mysql"
                )
            else:
                connection = pymysql.connect(
                user=user,
                passwd=passwd,
                host=host,
                port=n_port,
                db="mysql"
            )
 
After checking this, developers think could be a known issue: If the mysqlconf option is not set in Direct Admin, migration fails. It is registered here as ID PMT-4811. In order to be sure that this is the same issue, we'd need to check it on the source server. This could be done if you open a support ticket and let support staff know PPS-14581 and PMT-4811 and whether it can be verified that it is the same issue as documented here already.
 
Hello @Peter Debik ,

Here is the source server information:
Code:
CentOS Linux release 7.9.2009 (Core)
DirectAdmin v.1.650 012240df134922e26c50eb42161af66e4f9d3d59
10.5.17-MariaDB MariaDB Server


The problem arises from dumper.py looking at /usr/local/directadmin/conf/directadmin.conf to determine the location of mysqlconf. It then retrieves the passwd value from mysqlconf, which is stored at /usr/local/directadmin/conf/mysql.conf.

However, when the dumper.py has all the information and tries to connect to MySQL/MariaDB Server with user da_admin via host 127.0.0.1, which is not permitted in DirectAdmin, it results in an error (1045, u"Access denied for user 'da_admin'@'127.0.0.1' (using password: YES)").

On the other hand, if dumper.py tries to connect to MySQL/MariaDB Server with the same user da_admin and password but via host "localhost" instead of "127.0.0.1" everything works correctly.

NVIDIA_Share_WBUdwAyIit.png
 
Thank you again, now accepted as a product issue here, registered as ID PMT-5179. Thank you again for the workaround, too. It will be helpful for others who experience the same issue.
 
Back
Top