日期:2014-05-16 浏览次数:20780 次
[root@xx ~]# mysql -u root -p Enter password: 输入密码
mysql> use mysql;
mysql> insert into user(host,user,password) values ("%","game",password("xxxxx")); Query OK, 1 row affected, 4 warnings (0.00 sec)
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
mysql> create database game; Query OK, 1 row affected (0.06 sec)
mysql> grant all privileges on game.* to game@"%" identified by 'xxxx'; Query OK, 0 rows affected (0.00 sec)
mysql>grant select,update on game.* to game@localhost identified by 'xxxx';
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
mysql>update mysql.user set password=password('新密码') where User="game" and Host="%";
mysql>DELETE FROM user WHERE User="game" and Host="localhost"; mysql>flush privileges;
mysql> show grants for game; +-----------------------------------------------------------------------------------------------------+ | Grants for game@% | +-----------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'game'@'%' IDENTIFIED BY PASSWORD '*6830234338985B955032067DE689AFC3ECD27EEA' | | GRANT ALL PRIVILEGES ON `game`.* TO 'game'@'%' | +-----------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec)
revoke all on game.* from game@%;