Why doesn't MySQL ask for a password from root?

December 19, 2018 466 views
MySQL Ubuntu 18.04

And yes, I have renamed /root/.digitalocean_password. Also does it from sudo. I set the password and flushed privileges yesterday.

root@web01:~# mv /root/.digitalocean_password /root/.digitalocean_password.good
root@web01:~# mysql -u root wordpress
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1207
Server version: 5.7.24-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ^DBye
root@web01:~# logout
cdevidal@web01:~$ sudo mysql -u root wordpress
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1208
Server version: 5.7.24-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
1 Answer
jarland MOD December 19, 2018
Accepted Answer

Hey friend,

This should be the correct functionality if logged in as the root system user. It needs no security from root, as root has full control over the system and packages anyway.

Jarland

Have another answer? Share your knowledge.