Home > Database > Mysql Tutorial > body text

How to create username and password in mysql

王林
Release: 2020-10-13 14:14:52
Original
12340 people have browsed it

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 '密码';
Copy after login

Such as:

CREATE USER 'kfcx' IDENTIFIED BY 'kfcx123';
Copy after login

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
Copy after login

Such as:

D:mysql\bin\mysqld-nt --skip-grant-tables
Copy after login

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;
Copy after login

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!

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