DEV Community

Nahue
Nahue

Posted on • Originally published at nahuelhds.dev on

Solving MariaDB errors on Travis CI

ERROR 1698 (28000): Access denied for user ‘root’@’localhost’

You need to use sudo in the line execution. Yeah. Just that.

I had this .travis.yml file

addons:
  mariadb: 10.4

before_script:
  - mysql -e 'create database testing;'

Notice the mysql -e 'create database testing;' line. The fix was using sudo

addons:
  mariadb: 10.4

before_script:
  - sudo mysql -e 'create database testing;'

SQLSTATE[HY000] [1698] Access denied for user ‘travis’@’localhost’

This error happens because Travis by default uses dist: xenial which is not fully compatible with the MariaDB addon yet.

The solution is setting dist: precise in your .travis.yml file

dist: precise

# ... rest of your config file

And that’s it. Hope it helps!

Top comments (0)