0

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?

A R
  • 500
  • 2
  • 7
  • 20

2 Answers2

1

Specify a user option in the [client] section of ~/.my.cnf

...but generally its considered bad practice to use the admin account for normal use of a system.

symcbean
  • 47,736
  • 6
  • 59
  • 94
0

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.

A R
  • 500
  • 2
  • 7
  • 20