mysql> show full processlist;
+----+------+-----------------+-------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------------+-------+---------+------+-------+-----------------------+
| 1 | root | localhost:24980 | mysql | Query | 0 | init | show full processlist |
+----+------+-----------------+-------+---------+------+-------+-----------------------+
1 row in set (0.00 sec)
mysql> set password for 'root'@'tony7' = password('mysql');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'127.0.0.1' = password('mysql');
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | tony7 | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | 127.0.0.1 | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | ::1 | |
| | localhost | |
| | tony7 | |
+------+-----------+-------------------------------------------+
6 rows in set (0.00 sec)
mysql> delete from mysql.user where host='::1';
Query OK, 1 row affected (0.00 sec)
mysql> delete from mysql.user where host='tony7' and user='';
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> delete from mysql.user where host='localhost' and user='';
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | tony7 | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | 127.0.0.1 | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)
mysql>
#export MYSQL_PS1="(\u@\h) [\d]> "
(root@localhost) [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)