maxlapshin / mysql2postgres

Mysqldump, writing in postgresql format
MIT License
709 stars 156 forks source link

/mysql2psql:166:in `list_tables': No database selected (Mysql::Error) #8

Closed gour closed 14 years ago

gour commented 14 years ago

Hello,

I've downloaded both Full_Simple_Invoices.sql and structure.sql from SimpleInvoices project in order to try to migrate database to Postgres, but with both I get the following:

[gour@gaura-nitai si] ./mysql2psql
./mysql2psql:166:in list_tables': No database selected (Mysql::Error) from ./mysql2psql:166:intables' from ./mysql2psql:614:in convert' from ./mysql2psql:679:in

'

Here is the list of tables as shown within mysql:

mysql> show tables;
+---------------------------+
| Tables_in_simple_invoices |
+---------------------------+
| si_biller                 |
| si_custom_fields          |
| si_customers              |
| si_extensions             |
| si_invoice_item_tax       |
| si_invoice_items          |
| si_invoice_type           |
| si_invoices               |
| si_log                    |
| si_payment                |
| si_payment_types          |
| si_preferences            |
| si_products               |
| si_sql_patchmanager       |
| si_system_defaults        |
| si_tax                    |
| si_user                   |
| si_user_domain            |
| si_user_role              |
+---------------------------+
19 rows in set (0.00 sec)

Any idea?

Sincerely, Gour

gour commented 14 years ago

I'ver noticed the change in config file's syntax, tried again, this time without file parameter in destination, and now I get:

[gour@gaura-nitai si] ./mysql2psql
./mysql2psql:408:in connection': undefined methodsplit' for nil:NilClass (NoMethodError) from ./mysql2psql:414:in initialize' from ./mysql2psql:670:innew' from ./mysql2psql:670:in `

'

maxlapshin commented 14 years ago

How do you think is possible to help you without config.yml ?

gour commented 14 years ago

Well, it's the same config as I used in previous issue... :-)

Here it is:

mysql:
 hostname: localhost
 port: 3306
 socket: /var/run/mysqld/mysqld.sock
 username: gour
 password: ggd
 databasename: simple_invoices 

destination:
 # if file is given, output goes to file, else postgres
 file: 
 postgres:
  hostname: localhost
  port: 5432
  username: gour
  password: ggd
  databasename: simple_invoices

tables:
- si_biller
- si_custom_fields
- si_customers
- si_extensions
- si_invoice_item_tax
- si_invoice_items
- si_invoice_type
- si_invoices
- si_log
- si_payment
- si_payment_types
- si_preferences
- si_products
- si_sql_patchmanager
- si_system_defaults
- si_tax
- si_user
- si_user_domain
- si_user_role  
maxlapshin commented 14 years ago

Remove tables section at all.

gour commented 14 years ago

Here is the result:

[gour@gaura-nitai si] ./mysql2psql
./mysql2psql:408:in connection': undefined methodsplit' for nil:NilClass (NoMethodError) from ./mysql2psql:414:in initialize' from ./mysql2psql:670:innew' from ./mysql2psql:670:in `

'

maxlapshin commented 14 years ago

Change databasename to database

gour commented 14 years ago

Now it worked!!

Thank you.