Search code examples
mysqlbashopensusemageia

How do I change the default MySQL user on OpenSuSE 13.1


How do I get the "mysql" command to open a connection to MySQL with the root user? I don't want to type mysql --user root, I want it to start immediately.

I have two machines: Mageia 3 and OpenSuSE 13.1. The Mageia machine does this exactly when I open a terminal as the normal user: it simply starts a mysql session and when I type SELECT USER(); it says "root@localhost".

The OpenSuSE machine tries to use the current bash user to connect to mysql instead of using root. How do I configure this behavior?


Solution

  • Although symcbean's solution works, I found it easier to create a user with the same name as the Linux account that is calling the command. Give this user enough privileges and voilà. This way avoids the problem mentioned by symcbean.