When swarming, got ERROR 1698 (28000): Access denied for user 'root'@'localhost' mysql

It appears that newer versions of mysql-server don’t permit using root username to connect when executing from non-root (non-sudo) login. So, you have to create a different username in mysql and configure nupic to use that username before running swarms.

I was using Ubuntu Server 16.04 and mysql 5.7.12 with the swarming tests, but I needed to configure mysql-related settings first to get the mysql connectivity (used by swarming) to work. The error I was getting from mysql was:

ERROR 1698 (28000): Access denied for user 'root'@'localhost' mysql

$ mysql --version
mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper

This is what I needed to do to work around this error:

  1. Create a new mysql user “vitaly” and grant this user privileges on all databases. I chose to have a blank password.

     $ sudo mysql -u root -p
    
     mysql> create user 'vitaly'@'localhost' identified by '';
     mysql> GRANT ALL PRIVILEGES ON * . * TO 'vitaly'@'localhost';
     mysql> FLUSH PRIVILEGES;
     mysql> exit
     Bye
    
  2. Modify mysql username in nupic configuration by setting my user name in the nupic.cluster.database.user property:

     $ vim $NUPIC/src/nupic/support/nupic-default.xml
    
     <property>
       <name>nupic.cluster.database.user</name>
       <value>vitaly</value>
       <description>Username for the MySQL database server </description>
     </property>
    
  3. Tell nupic and tests where to find the nupic-default.xml configuration file NOTE: I needed this step, because running swarming tests was resulting in the ERROR OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ((1251, u'Client does not support authentication protocol requested by server; consider upgrading MySQL client'))"). I filed https://github.com/numenta/nupic/issues/3189 for this bug. However, hotgym.py example worked without this step.

     $ export NTA_CONF_PATH="$NUPIC/src/nupic/support"
    
  4. Run the swarming tests

     $ ./scripts/run_nupic_tests.py -w
    
  5. run hotgym

~/nta/nupic/examples/opf/clients/hotgym/simple$ python hotgym.py
INFO:__main__:After 100 records, 1-step altMAPE=23.183145
INFO:__main__:After 200 records, 1-step altMAPE=21.548877
INFO:__main__:After 300 records, 1-step altMAPE=21.227594
INFO:__main__:After 400 records, 1-step altMAPE=20.686270
INFO:__main__:After 500 records, 1-step altMAPE=20.417234
INFO:__main__:After 600 records, 1-step altMAPE=20.852339
INFO:__main__:After 700 records, 1-step altMAPE=20.907660
INFO:__main__:After 800 records, 1-step altMAPE=21.137106
INFO:__main__:After 900 records, 1-step altMAPE=20.875763
INFO:__main__:After 1000 records, 1-step altMAPE=20.789707
~/nta/nupic/examples/opf/clients/hotgym/simple$ echo $?
0
6 Likes

@rhyolight, NOTE: I needed to set the environment variable NTA_CONF_PATH, because running swarming tests

./scripts/run_nupic_tests.py -w

was resulting in the ERROR OperationalError: (2003, “Can’t connect to MySQL server on ‘localhost’ ((1251, u’Client does not support authentication protocol requested by server; consider upgrading MySQL client’))”).

However, hotgym.py example worked without setting this variable.

So, it appears to be a bug when running ./scripts/run_nupic_tests.py -w.

If I recall correctly, I installed nupic from source via python setup.py develop --user (after compiling and installing nupic.bindings from source)

Thanks for this report @vkruglikov, and also thanks for creating the issue:

https://github.com/numenta/nupic/issues/3189

I followed suggestions of vkruglikov. Thanks!

At first I made a copy of $NUPIC/src/nupic/support/nupic-default.xml to $NUPIC/src/nupic/support/nupic-site.xml and changed database user name there but it didn’t work. It didn’t work with $NUPIC/src/nupic/support/nupic-default.xml either.

Experimentally changed then configuration file in:
~/.local/lib/python2.7/site-packages/nupic/support/nupic-default.xml
i.e. inserted there generated mysql user name.
After that ‘python $NUPIC/examples/swarm/test_db.py’ was successful (Connection successful!!).

1 Like

@kalle.tammemae, thank you for following up. This makes sense, because I installed nupic via

so, my NTA_CONF_PATH needed to be in the local repo tree. You must have installed via the non-develop method, so your NTA_CONF_PATH needed to point inside your installation directory.

Best,
Vitaly