Home >Database >Mysql Tutorial >How to create username and password in mysql

How to create username and password in mysql

王林
王林Original
2020-10-13 14:14:5212373browse

How to create username and password in mysql: Execute the [CREATE USER 'username' IDENTIFIED BY 'password';] statement to create it successfully.

How to create username and password in mysql

SQL statement:

(Recommended tutorial: mysql video tutorial)

CREATE USER '用户名' IDENTIFIED BY '密码';

Such as:

CREATE USER 'kfcx' IDENTIFIED BY 'kfcx123';

What should I do if I forget my Mysql password?

1. Stop the mysql service

2. Open the command line window and execute it in the mysql installation directory bin

mysqld-nt --skip-grant-tables

Such as:

D:mysql\bin\mysqld-nt --skip-grant-tables

3. If it is For mysql5.0 or above, you can directly double-click mysql.exe

4 in the bin of the mysql installation directory. 4. use mysql --select the mysql database

  update user set password=password('新的密码')where user='要修改密码的用户名';
   flush privileges;
   exit;

5. Kill the mysqld-nt process and restart mysql. Just log in to the service with a new password.

Related recommendations: mysql tutorial

The above is the detailed content of How to create username and password 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