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

  mariadb: 10.4

  - mysql -e 'create database testing;'

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

  mariadb: 10.4

  - 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!

Thanks for your time!

I'm nahuelhds. If you like what I do, you can...