Home >Database >Mysql Tutorial >About how to create a new user and authorize it in MySQL

About how to create a new user and authorize it in MySQL

一个新手
一个新手Original
2017-10-10 09:58:501119browse
  • Syntax for creating a user:

         Create user  `username`@host  [Identified by [password]  `password`];
Username:用户名
Host:主机名,本地主机可以用localhost或者ip地址,但是其他电脑必须用ip地址登录远程主机用通配符 “%”
Password:用户密码

Example:

         create user  `teacher`@`localhost` identified  by  ‘12345’,   或者
         create user  `teacher`@`localhost  (无密码)
  • Execute grant (While granting permissions) Create user

Syntax:

Grant priv_type on database or data table to username@localhost (or IP address) identified by '123';

  • Use mysql AdminModify rootAccount password

  • ##Syntax:

  •   Mysqladmin –u root –p password  “123”;
      Enter password:原密码(root)
  • Use the set password to change the ordinary user password (mysql command)

Syntax:

  Set password=password(“000”);                           //修改当前用户密码
 Set password for teacher@localhost=password(“123”);   //修改指定账户密码

  • Delete normal user

  •  Drop  user  `studentr` @localhost;

The above is the detailed content of About how to create a new user and authorize it in MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:DAO mode in mysqlNext article:DAO mode in mysql