How to deny access to any system user who attempts to log in without password usage? I have mysql-server-5.5 in Ubuntu Server 12.04

I realized that when typing mysql command logged as any system user I got access to mysql, despite I can only display test and information_schema databases, how can I disable this accesses?

I don't have those users registered on mysql so I don't want this to have access.

This is what happens

user-one@server:~$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 39950
Server version: 5.5.38-0ubuntu0.12.04.1-log (Ubuntu)...

mysql&gt; SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)

user-two@server:~$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 39950
Server version: 5.5.38-0ubuntu0.12.04.1-log (Ubuntu)...

mysql&gt; SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)


When looking as root for this users in case they are registered

mysql&gt; use mysql
mysql&gt; SELECT * FROM user WHERE User = 'user-one';
Empty set (0.00 sec)

mysql&gt; SELECT * FROM user WHERE User = 'user-two';
Empty set (0.00 sec)
By default ''@localhost, and other bunch of accounts exist in a freshly installed MySQL instance.

If you execute SELECT user() you may see something like this:

mysql&gt; SELECT user();
+--------------------+
| user()             |
+--------------------+
| user-one@localhost |
+--------------------+
1 row in set (0.00 sec)


That user doesn't really exist, and it is actually mapped for authentication and authorization to:

mysql&gt; SELECT current_user();
+----------------+
| current_user() |
+----------------+
| ''@localhost   |
+----------------+
1 row in set (0.00 sec)


In order to fix this, run the script mysql_secure_installation always after setting up a production database, and it will ask you to set a mysql root password, delete remote access and delete the passwordless default accounts. This should be part of any proper mysql installation process, and it is documented here.

Starting with 5.6 and 5.7, better security defaults are used, but only on official packages.

Remember that by default, all users have write permissions to write on test% databases. That is a very dangerous default, and should be fixed before production.