如何在MySQL中创建拥有所有权限的用户?

命令语法

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>
赞(52) 打赏
未经允许不得转载:优客志 » 系统运维
分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏