Home >Database >Mysql Tutorial >About how to create a new user and authorize it in MySQL
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”); //修改指定账户密码
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!