I'm trying to use mwdumper jar to import a wiktionary dump to a db that I created with MAMP Pro. Here is the command that I'm struggling with:
java -jar mwdumper-1.25.jar --format=sql:1.5 /Users/med/Downloads/enwiktionary-20171001-pages-articles-multistream.xml --output=mysql://localhost:8889/wiktionay?user=wikiuser&password=wiki2017
Running the jar with this command gives the following:
> [1] 1209
$ Exception in thread "main" java.io.IOException: Access denied for user 'wikiuser'@'localhost' (using password: NO)
at org.mediawiki.dumper.Dumper.connectMySql(Dumper.java:225)
at org.mediawiki.dumper.Dumper.openOutputFile(Dumper.java:211)
at org.mediawiki.dumper.Dumper.main(Dumper.java:96)
Caused by: java.sql.SQLException: Access denied for user 'wikiuser'@'localhost' (using password: NO)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1694)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1244)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2397)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2430)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at org.mediawiki.dumper.Dumper.connectMySql(Dumper.java:221)
... 2 more
When I simply try to connect to the DB from the terminal, I have no access problem:
$ /Applications/MAMP/Library/bin/mysql -u wikiuser -p
As mentioned in related issues, I checked "Allow network access to MySQL" from the MAMP Interface but still it didn't help. Same issue by using root.
Any idea what's wrong?
Problem is that due to & operator password in the URL gets as separate command while sending URL on terminal. Hence, mysql never gets password.
Use \ to escape & i.e.
--output=mysql://localhost:8889/wiktionay?user=wikiuser\&password=wiki2017
Edited: 04:14 AM, IST
Exception in thread "main" java.lang.IllegalArgumentException: Expected file stream, got SQL connection?
Try passing stream filename at the end i.e. after --output followed by --format and then /Users/med/Downloads/enwiktionary-20171001-pages-articles-multistream.xml