Create MySQL user

MySQL is a widely used relational database management system that provides many functions to manage and operate databases. In MySQL, creating users is a common task, which allows users to authenticate via username and password and grants them access to the database. This article will explain how to create a user in MySQL and grant appropriate permissions.

First, we need to log in to the MySQL server as a user with sufficient permissions. Before logging in, make sure MySQL is installed and the server can be accessed via command line or graphical interface tools.

After logging into the MySQL server, open a terminal or command prompt window and enter the following command to log in as the root user:

mysql -u root -p

Next, you will be prompted to enter the password for the root user. After entering the password, press Enter to log in to the MySQL server.

Once successfully logged into the MySQL server, we can use the following command to create a new user:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

In the above command, usernamereplace with the username you want to create and passwordreplace with the user you want to create

Guess you like

Origin blog.csdn.net/wellcoder/article/details/133491858