我有一个新的 mysql 安装,并试图创建一个单独的用户来访问他们自己的数据库。
mysqladmin -u root -p create people
mysql> create user 'cgp'@'localhost' identified by 'myPass';
mysql> grant all on people to 'cgp'@'localhost' identified by 'myPass';
Query OK, 0 rows affected (0.00 sec) <-- problem here?
mysqladmin -v -u root -p flush-privileges
mysql -h localhost -u cgp -p people
Enter password:
ERROR 1044 (42000): Access denied for user 'cgp'@'localhost' to database 'people'
mysql -u root -p
mysql> show grants;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*xxx' WITH GRANT OPTION
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
正如您所看到的,对于 cgp 用户,Grant 表中没有任何内容。我究竟做错了什么?
尝试
grant all on people.* to 'cgp'@'localhost' identified by 'myPass';