怎样创建mysql账户

2012年7月2日 | 分类: mysql | 标签:

1.用root登陆mysql

mysql -u root -p

2.用GRANT命令创建新账户

mysql>   GRANT ALL ON <database_name>.* TO <new_account>@<server> IDENTIFIED BY '';

Example:I have database called demo and i want to assign all privileges to new account called user1, i will type the following command:

mysql>   GRANT ALL ON demo.* TO user1@localhost IDENTIFIED BY 'mypassword';

Note: GRANT ALL is means set all privileges to new account. But only on demo database and can’t access other database.

3.退出mysql

mysql>   exit;
  1. xiaobao
    2012年7月2日23:38

    不错不错,值得学习

    • ryan
      2012年7月2日23:40

      谢谢支持,欢迎常来