Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL allows connection without password although password is set
    primarykey
    data
    text
    <p>I'm setting a MySQL server (actually a Percona server, but that shouldn't matter) and I'm setting a password to the root user. At the end, I have this:</p> <pre><code>mysql&gt; select host, user, password from user; +-----------+------------------+-------------------------------------------+ | host | user | password | +-----------+------------------+-------------------------------------------+ | localhost | root | *huge string here, no kidding | | localhost | debian-sys-maint | *another huge string here | +-----------+------------------+-------------------------------------------+ 2 rows in set (0.00 sec) </code></pre> <p>I thought this should not allow the root user to connect without a password. However, if I go to the command line, I can connect with <code>mysql -u root</code> or just <code>mysql</code>. If I do <code>mysql -u root -p</code> and hit enter for the password, then I get <code>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO).</code></p> <p>Could anyone explain to me how to make sure a user can only connect with a password?</p> <p>Edit: if relevant, I set the password with <code>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('somethinghere');</code></p> <p>Edit: output of <code>show grants</code>, it indicates I used a password to login but I did not.</p> <pre><code>mysql&gt; show grants; +----------------------------------------------------------------------------------------------------------------------------------------+ | Grants for root@localhost | +----------------------------------------------------------------------------------------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*huge string here, no kidding' WITH GRANT OPTION | | GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION | +----------------------------------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload