GRANT ALL PRIVILEGES ON *.* TO admin@localhost IDENTIFIED BY 'something' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO admin@% IDENTIFIED BY 'something' WITH GRANT OPTION;
INSERT INTO user VALUES('localhost','admin',PASSWORD('something'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
INSERT INTO user VALUES('%','admin',PASSWORD('something'), 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
第一句增加了一个admin用户授权通过本地机(localhost)访问,密码“something”。第二句则是授与admin用户从任何其它主机发起的访问(通配符%)。
当没有用户 admin mysql 会自动添加此用户