Could not connect to target MySQL server as root.

Discussion in 'ISPConfig 3 Priority Support' started by spazio, Nov 9, 2021.

  1. spazio

    spazio Member HowtoForge Supporter

    Hi ,
    I'm in the process of migrating some old server using Ubuntu 16.04.7 LTS with the ispconfig Migration Tool and I'm geeting this error on the source server from the ISPConfig3 Migration Tool V2 Version 2.2.5
    The script begins and when I'm at the mysql section I get this

    [ERROR] Could not connect to target MySQL server as root.
    Please give me the MySQL master user for the TARGET server [root]:
    Please give me the password for MySQL user root [howtoforge]: roots password
    Please give me the MySQL hostname for the TARGET server [localhost]:
    Testing MySQL connection ... ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    FAILED
    [ERROR] Could not connect to target MySQL server as root.
    Please give me the MySQL master user for the TARGET server [root]: ^C
    root@old server:~/migration#

    Here is the log's file
    2021-11-08 23:09:37 - [INFO] Command mysql -h 'localhost' -u 'root' -p'roots password' -e "SELECT VERSION();" failed with code 1.
    2021-11-08 23:09:37 - [ERROR] Error connecting to mysql server on target.
    ^C
    But if I try the command in the consol:

    root@oldserver:~/migration# mysql -h 'localhost' -u 'root' -p'roots password' -e "SELECT VERSION();"
    +----------------------------------+
    | VERSION() |
    +----------------------------------+
    | 10.0.38-MariaDB-0ubuntu0.16.04.1 |
    +----------------------------------+
    root@oldserver:~/migration#

    Voila! It's works!!!
    I'm speachless... For me this is impossible but hey! maybe I'm just too tired.
    Anybody see something I don't?

    Thanks in advance
    Spazio
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    You might need to contact official migration support, which is via email (I've never used the migration toolkit offhand), but I believe 'localhost' is incorrect there, the target server is where you're moving stuff to (and I believe you run the migration tool on the source server?).
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    The target server is the new server, if I understand your tests correctly, you run this on the old server:

    Code:
    root@oldserver:~/migration# mysql -h 'localhost' -u 'root' -p'roots password' -e "SELECT VERSION();"
    +----------------------------------+
    | VERSION() |
    +----------------------------------+
    | 10.0.38-MariaDB-0ubuntu0.16.04.1 |
    +----------------------------------+
    root@oldserver:~/migration#
    but the actual error is on the new system, so you must run this test on the new server instead of the old one. The migration Tool connects from old server (where you run the tool) to the new server via SSH and tries to connect from the new server to its local MySQL database as the root user, so localhost as host is fine, but the command to test it must be run on the new system instead. What you should check is that the MySQL root password on the new server in the file /usr/local/ispconfig/server/lib/mysql_clientdb.conf is correct, a wrong password in that file will trigger this error.
     
    Jesse Norell likes this.
  4. spazio

    spazio Member HowtoForge Supporter

    Thanks to both of you! I think I was just really tired for not realising I was running the command on the old system!
    After correcting the error everything worked perfectly!
    Really really great tool!

    Thanks
    spazio
     
    till likes this.

Share This Page