mysql>insert into mysql.user(Host,User,Password) values("localhost","test",password("1234"));
增加了一个用户名为test、密码为1234用户,但该用户只能在本地登陆,若想远程登陆的话可将localhost改为%表示任何一台电脑都可以登陆,或改为特定的ip表示只能在特定的ip地址上登陆。
mysql>grant all privileges on testDB.* to test@localhost identified by
‘1234‘;
mysql>Delete FROM user Where User=‘test‘ and Host=‘localhost‘;
mysql>update mysql.user set password=password(‘新密码‘) where User="test"
and Host="localhost";