删除用户:
delete from user where user="0" or user=null;
删除用户名为空和为0的用户。
添加mysql系统用户
GRANT ALL PRIVILEGES ON [dbname].* to
'[user]'@'[hostname]' identified by
'[password]'
添加一个用户
GRANT SELECT,INSERT,UPDATE,DELETE,DROP
on test.*
to `test`@`localhost`
identified by "test";
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user from user;
+-----------+----------------+
| host | user |
+-----------+----------------+
| % | |
| 127.0.0.1 | root |
| localhost | hello|
| localhost | root |
| localhost | test |
+-----------+----------------+
5 rows in set (0.00 sec)
插入数据后腰执行下面刷新语句。
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
delete from user where user="0" or user=null;
删除用户名为空和为0的用户。
添加mysql系统用户
GRANT ALL PRIVILEGES ON [dbname].* to
'[user]'@'[hostname]' identified by
'[password]'
添加一个用户
GRANT SELECT,INSERT,UPDATE,DELETE,DROP
on test.*
to `test`@`localhost`
identified by "test";
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user from user;
+-----------+----------------+
| host | user |
+-----------+----------------+
| % | |
| 127.0.0.1 | root |
| localhost | hello|
| localhost | root |
| localhost | test |
+-----------+----------------+
5 rows in set (0.00 sec)
插入数据后腰执行下面刷新语句。
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)