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:
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:
To:
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"
)