命令语法
mysql> GRANT ALL ON [dbname].[table] TO 'username'@'localhost' IDENTIFIED BY 'secret_password';
操作步骤
首先,用root帐号登录,并且使用下面的MySQL命令来创建新的拥有完全权限用户“rahul“。但这个用户只能可以访问本地主机数据库服务器。mysql> GRANT ALL ON *.* TO 'rahul'@'localhost' IDENTIFIED BY 'secret_password'; mysql> FLUSH PRIVILEGES;现在,重新登录
# mysql -u username -p'secret_password' Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 9522 Server version: 5.5.30-cll MySQL Community Server (GPL) by Atomicorp Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql>