首先检查您当前的权利;
mysql> show grants for 'john'@'localhost';
+--------------------------------------------------------------------------------------------+
| Grants for john'@'localhost |
+--------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'john'@'localhost' IDENTIFIED BY PASSWORD '0cdf93684d757e1f' |
| GRANT ALL PRIVILEGES ON `test_database_1`.* TO 'john'@'localhost' WITH GRANT OPTION |
+--------------------------------------------------------------------------------------------+
然后做一个'GRANT ALL'。如果您遗漏密码,则 mysql 将保留当前密码;
mysql> grant all on *.* to 'john'@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql> show grants for 'john'@'localhost';
+-----------------------------------------------------------------------------------------------+
| Grants for stubby@127.0.0.1 |
+-----------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'john'@'localhost' IDENTIFIED BY PASSWORD '0cdf93684d757e1f' |
| GRANT ALL PRIVILEGES ON `test_database_1`.* TO 'john'@'localhost' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------+
那应该这样做。