Home > Database > Mysql Tutorial > body text

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

一个新手
Release: 2017-10-10 09:58:50
Original
1094 people have browsed it
  • Syntax for creating a user:

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

Example:

         create user  `teacher`@`localhost` identified  by  ‘12345’,   或者
         create user  `teacher`@`localhost  (无密码)
Copy after login
  • 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)
    Copy after login
  • Use the set password to change the ordinary user password (mysql command)

Syntax:

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

  • Delete normal user

  •  Drop  user  `studentr` @localhost;
    Copy after login

    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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template