0

I have a MYSQL database(db_mysql) whose data I want to transfer to another PostgreSQL database(db_psql) which is initially empty.

I tried using the command pgloader mysql://root@localhost/db_mysql pgsql:///db_psql from the terminal(also using sudo)

But I keep getting an error like this Failed to connect to mysql at "localhost" (port 3306) as user "root": MySQL Error [1045]: "Access denied for user 'root'@'localhost' (using password: NO)"

I suppose it requires mysql password but I am not sure where to provide it

Jitesh Malipeddi
  • 2,150
  • 3
  • 17
  • 37

1 Answers1

1

use

 mysql://root:password@localhost/db_mysql pgsql:///db_psql
nbk
  • 45,398
  • 8
  • 30
  • 47
  • Thanks for your reply. I tried it out and it seemed to have solved the MYSQL part of the error but now, I am getting an other error like `ERROR Database error 42501: permission denied for db_psql QUERY: CREATE SCHEMA db_psql; FATAL Failed to create the schema, see above. ` – Jitesh Malipeddi May 22 '19 at 17:34
  • there is a similar syntax for postgrsql --> postgresql://[user[:password]@][netloc][:port] – nbk May 22 '19 at 17:48
  • Thanks a lot! The command worked and I was able to see the list of all tables,time taken to run the query, etc. But while I am connecting to the database and listing all tables in the postgresql shell, I am getting a message saying that 'No relations are found'. I am however sure that there are relations in the database because I am able to see the tables when I list them in MYSQL shell. – Jitesh Malipeddi May 22 '19 at 18:15
  • foreign keys are by default included look please here for all available options https://pgloader.readthedocs.io/en/latest/ref/mysql.html – nbk May 22 '19 at 18:45